{"record":{"id":"327486abb453e10f","repo":"zed-industries/zed","slug":"command-failed-with-exit-code-stdout-std","errorCode":null,"errorMessage":"command failed with exit code {:?}:\nstdout: {}\nstderr: {}","messagePattern":"command failed with exit code (.+?):\nstdout: (.+?)\nstderr: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/project/src/lsp_store.rs","lineNumber":2777,"sourceCode":"            }));\n        }\n\n        let mut child = child\n            .stdin(Stdio::piped())\n            .stdout(Stdio::piped())\n            .stderr(Stdio::piped())\n            .spawn()?;\n\n        let stdin = child.stdin.as_mut().context(\"failed to acquire stdin\")?;\n        let text = buffer\n            .handle\n            .read_with(cx, |buffer, _| buffer.as_rope().clone());\n        for chunk in text.chunks() {\n            stdin.write_all(chunk.as_bytes()).await?;\n        }\n        stdin.flush().await?;\n\n        let output = child.output().await?;\n        anyhow::ensure!(\n            output.status.success(),\n            \"command failed with exit code {:?}:\\nstdout: {}\\nstderr: {}\",\n            output.status.code(),\n            String::from_utf8_lossy(&output.stdout),\n            String::from_utf8_lossy(&output.stderr),\n        );\n\n        let stdout = String::from_utf8(output.stdout)?;\n        if stdout.is_empty() && !text.is_empty() {\n            // Some formatters (e.g. `cargo fmt`) rewrite files on disk instead of\n            // printing the formatted contents to stdout. Treating empty stdout as the\n            // new buffer contents would erase the buffer, so leave it untouched.\n            log::warn!(\n                \"External formatter `{command}` produced no output on stdout; leaving the buffer unchanged\"\n            );\n            return Ok(None);\n        }","sourceCodeStart":2759,"sourceCodeEnd":2795,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/project/src/lsp_store.rs#L2759-L2795","documentation":"An external formatter/linter child process spawned by the language server exited with a non-zero status after receiving the buffer text on stdin; stdout and stderr of the child are included in the message.","triggerScenarios":"Thrown at crates/project/src/lsp_store.rs:2652 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the embedded stderr for the tool's own failure reason","Verify the server binary and its runtime (e.g. node) are installed and compatible","Fix the buffer content if it makes the tool crash"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}