rust-analyzer.checkOnSave.command works but shows invalid config warning

Note: I initially thought this was dependent on rust-analyzer.linkedProjects setting posted with unrelated info and title. Sorry about that. I've fixed it now.

When I add "rust-analyzer.checkOnSave.command": "clippy" I get:

invalid config value: /checkOnSave: invalid type: map, expected a boolean;
Extension Info: Version 0.3.2433, Server Version 0.3.2433-standalone (66e3b5819e 2025-04-21)

and in Language Server logs:

[Error - 3:26:22 AM] Server process exited with code 0.

Clippy works fine but these warnings stays and extensions shows yellow/unstable in VSCode:

Additionally, if I replace

    "rust-analyzer.checkOnSave.command": "clippy"

with

    "rust-analyzer.checkOnSave": true,
    "rust-analyzer.checkOnSave.command": "clippy"

, it hides the warning but clippy isn't run on save.

So, it's a cosmetic issue I guess. I was just wondering if there's a different way to set that flag.

From the documentation, it seems like rust-analyzer.checkOnSave.command does not exist. It should be rust-analyzer.check.command.

1 Like

If I remove the rust-analyzer.checkOnSave setting from my settings.json, then open the settings viewer (Command-, on macOS), and navigate to the Extensions>rust-analyzer section, I see a box with red background and border that says, Setting has an invalid type, expected "boolean". Fix in JSON.. If I click on the Edit in settings.json link, "rust-analyzer.checkOnSave": false, has been inserted.

According to https://rust-analyzer.github.io/book/configuration.html, there is a rust-analyzer.checkOnSave setting, and its default is true.

If I explicitly set it to true in the settings.json file, it seems to fix the warning.

It is rust-analyzer.checkOnSave.command that does not exist. This is in the snippet you posted further above.

Just noticed that. Thx. That rust-analyzer.check.command works too.

Interestingly rust-analyzer.checkOnSave.command also has same effect. Not sure why.
It does seem to be mentioned on its Github repo too:

That must be an older name for it.

Just found the reason.

rust-analyzer.check.command was previously rust-analyzer.checkOnSave.command. They decided to change it.
Additionally, rust-analyzer.checkOnSave became a boolean as enabling flag.

Not sure why they didn't mark rust-analyzer.checkOnSave.command as deprecated too. It should be possible to do that.

1 Like

Note that I am not the original poster. I was having an issue apparently due to the rust-analyzer.checkOnSave setting (without .command). I did a Google search and found this discussion, which at least seemed related.

Now that the original poster found the change that renamed checkOnSave to check (except, apparently, for the overall enable boolean), I would suspect that change also broke the remaining checkOnSave. Seems weird that it complains that false is an invalid boolean value (but accepts true).

1 Like