{"record":{"id":"6aa73f5c71ac0bc8","repo":"rust-lang/rust-analyzer","slug":"cargo-check-failed-to-start-err","errorCode":null,"errorMessage":"cargo check failed to start: {err}","messagePattern":"cargo check failed to start: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/main_loop.rs","lineNumber":1294,"sourceCode":"                let (state, message) = match progress {\n                    flycheck::Progress::DidStart { user_facing_command } => {\n                        self.flycheck_formatted_commands[id] = format_with_id(user_facing_command);\n                        (Progress::Begin, None)\n                    }\n                    flycheck::Progress::DidCheckCrate(target) => (Progress::Report, Some(target)),\n                    flycheck::Progress::DidCancel => {\n                        self.last_flycheck_error = None;\n                        *cargo_finished = true;\n                        (Progress::End, None)\n                    }\n                    flycheck::Progress::DidFailToRestart(err) => {\n                        self.last_flycheck_error =\n                            Some(format!(\"cargo check failed to start: {err}\"));\n                        return;\n                    }\n                    flycheck::Progress::DidFinish(result) => {\n                        self.last_flycheck_error =\n                            result.err().map(|err| format!(\"cargo check failed to start: {err}\"));\n                        *cargo_finished = true;\n                        (Progress::End, None)\n                    }\n                };\n\n                // Clone because we &mut self for report_progress\n                let title = self.flycheck_formatted_commands[id].clone();\n                self.report_progress(\n                    &title,\n                    state,\n                    message,\n                    None,\n                    Some(format!(\"rust-analyzer/flycheck/{id}\")),\n                );\n            }\n        }\n    }\n","sourceCodeStart":1276,"sourceCodeEnd":1312,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/main_loop.rs#L1276-L1312","documentation":"rust-analyzer's flycheck (cargo check) integration records a 'cargo check failed to start' message in last_flycheck_error when the cargo process could not be spawned or exited with a startup failure. The message surfaces in the IDE as an error notification/progress end. It indicates the configured cargo check command never actually ran.","triggerScenarios":"flycheck::Progress::DidFailToStart with an err — e.g. the cargo binary isn't found, the configured overrideCommand is invalid/unavailable, or the spawn failed — and DidFinish returning an Err result with the same startup-failure semantics.","commonSituations":"rust-analyzer installed in an environment without cargo in PATH; a custom `rust-analyzer.check.overrideCommand` pointing to a nonexistent binary; running the IDE inside a container/WSL where the toolchain isn't installed; workspace where cargo can't start due to a broken toolchain (rustup shim issues).","solutions":["Verify `cargo check` runs in a terminal from the workspace root; fix PATH or install rustup/cargo if not.","If check.overrideCommand is set, correct it or remove it to use the default `cargo check --workspace ...`.","Check rust.analyzer.linkedProjects / workspace layout — a bad root can make cargo fail immediately.","Reinstall/repair the toolchain (rustup update / rustup component add) if the shim or toolchain is broken.","Check the rust-analyzer output channel for the underlying `err` detail."],"exampleFix":"// before (settings.json)\n\"rust-analyzer.check.overrideCommand\": [\"cargo\", \"clippy-x\", \"--workspace\"]\n// after\n\"rust-analyzer.check.overrideCommand\": [\"cargo\", \"clippy\", \"--workspace\", \"--message-format=json\"]","handlingStrategy":"validation","validationCode":"# Before launching rust-analyzer, verify flycheck can run:\ncargo check --workspace --message-format=json > /dev/null && echo OK || echo FIX_ENV","typeGuard":null,"tryCatchPattern":"// Client side (VS Code): listen for window/showMessage type=Error\nclient.onNotification(lsp.ShowMessageNotification.type, (p) => {\n  if (p.message.startsWith('cargo check failed to start')) {\n    // surface remediation: check PATH / check.overrideCommand\n  }\n});","preventionTips":["Ensure cargo is on PATH in the environment where rust-analyzer runs (IDE, container, remote).","Validate any check.overrideCommand by running it manually first.","Keep the toolchain healthy: rustup update, repair rustup shims.","Watch the rust-analyzer output channel for the underlying err detail."],"tags":["rust","cargo","flycheck","lsp","environment"],"backgroundTag":"cargo-check-failed-to-start","analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}