{"record":{"id":"d0dc7333d67b6e7f","repo":"zed-industries/zed","slug":"cargo-command-failed","errorCode":null,"errorMessage":"Cargo command failed","messagePattern":"Cargo command failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/project/src/debugger/locators/cargo.rs","lineNumber":148,"sourceCode":"                    .args\n                    .iter()\n                    .cloned()\n                    .take_while(|arg| arg != \"--\")\n                    .chain(Some(\"--message-format=json\".to_owned()))\n                    .collect::<Vec<_>>(),\n            )\n            .envs(build_config.env.iter().map(|(k, v)| (k.clone(), v.clone())))\n            .current_dir(cwd)\n            .stdout(SmolStdio::piped())\n            .spawn()?;\n\n        let mut output = String::new();\n        if let Some(mut stdout) = child.stdout.take() {\n            stdout.read_to_string(&mut output).await?;\n        }\n\n        let status = child.status().await?;\n        anyhow::ensure!(status.success(), \"Cargo command failed\");\n\n        let is_test = build_config\n            .args\n            .first()\n            .is_some_and(|arg| arg == \"test\" || arg == \"t\");\n\n        let is_ignored = build_config.args.contains(&\"--include-ignored\".to_owned());\n\n        let executables = output\n            .lines()\n            .filter(|line| !line.trim().is_empty())\n            .filter_map(|line| serde_json::from_str(line).ok())\n            .filter(|json: &Value| {\n                let is_test_binary = json\n                    .get(\"profile\")\n                    .and_then(|profile| profile.get(\"test\"))\n                    .and_then(Value::as_bool)\n                    .unwrap_or(false);","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/project/src/debugger/locators/cargo.rs#L130-L166","documentation":"The cargo debug locator spawned the user's build command (with --message-format=json) to find the binary, and the process exited non-zero or its JSON output yielded no runnable target. The underlying cargo failure is the root cause; the error is raised in the locator's run method.","triggerScenarios":"Thrown at crates/project/src/debugger/locators/cargo.rs:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the same cargo build command manually to see the compile error and fix it","Verify the build command, target, and features in the debug scenario","Ensure cargo emits JSON messages (the locator appends --message-format=json) and the binary target actually gets built"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}