zed-industries/zed · error

command failed with exit code {:?}: stdout: {} stderr: {}

Error message

command failed with exit code {:?}:
stdout: {}
stderr: {}

What it means

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.

Source

Thrown at crates/project/src/lsp_store.rs:2777

            }));
        }

        let mut child = child
            .stdin(Stdio::piped())
            .stdout(Stdio::piped())
            .stderr(Stdio::piped())
            .spawn()?;

        let stdin = child.stdin.as_mut().context("failed to acquire stdin")?;
        let text = buffer
            .handle
            .read_with(cx, |buffer, _| buffer.as_rope().clone());
        for chunk in text.chunks() {
            stdin.write_all(chunk.as_bytes()).await?;
        }
        stdin.flush().await?;

        let output = child.output().await?;
        anyhow::ensure!(
            output.status.success(),
            "command failed with exit code {:?}:\nstdout: {}\nstderr: {}",
            output.status.code(),
            String::from_utf8_lossy(&output.stdout),
            String::from_utf8_lossy(&output.stderr),
        );

        let stdout = String::from_utf8(output.stdout)?;
        if stdout.is_empty() && !text.is_empty() {
            // Some formatters (e.g. `cargo fmt`) rewrite files on disk instead of
            // printing the formatted contents to stdout. Treating empty stdout as the
            // new buffer contents would erase the buffer, so leave it untouched.
            log::warn!(
                "External formatter `{command}` produced no output on stdout; leaving the buffer unchanged"
            );
            return Ok(None);
        }

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Inspect the embedded stderr for the tool's own failure reason
  2. Verify the server binary and its runtime (e.g. node) are installed and compatible
  3. Fix the buffer content if it makes the tool crash
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/project/src/lsp_store.rs:2652 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/327486abb453e10f. Report an issue: GitHub.