zed-industries/zed · error

Command failed with status

Error message

Command failed with status {}

What it means

run_command in the GPUI publish xtask spawns an external process and bails with this generic error whenever the child exits non-zero. The error only carries the exit status, not stderr, so the caller must infer which command failed from the `+ <command>` line echoed just before execution. It is the common failure funnel for every git/cargo step of publish-gpui.

Solutions

  1. Read the `+ <command>` line above the error to identify which child process failed and re-run it manually to see stderr
  2. For cargo publish failures, run `cargo login` or set a valid CARGO_REGISTRY_TOKEN
  3. If the version already exists on crates.io, bump the version in Cargo.toml and retry
  4. Check network/registry availability (https://crates.io) and proxy settings

Example fix

// before
bail!("Command failed with status {}", output.status);

// after (include stderr for diagnosis)
bail!(
    "Command failed with status {}: {}",
    output.status,
    String::from_utf8_lossy(&output.stderr)
);
Defensive patterns

Strategy: try-catch

Validate before calling

// verify prerequisites before invoking xtask
git rev-parse --is-inside-work-tree
cargo --version
echo -n "$CARGO_REGISTRY_TOKEN" | grep -q . || echo "registry token missing"

Try / catch

match xtask_publish().context("publish-gpui failed") {
    Ok(()) => println!("published"),
    Err(e) if e.to_string().contains("Command failed with status") => {
        eprintln!("A pipeline step failed; inspect the '+ <command>' line above: {e:#}")
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Any Command passed to run_command exits with a non-zero status: `git status` failing (e.g. not a git repo), `cargo publish` failing (auth token invalid, version already exists, network error), or similar subcommands in the publish pipeline.

Common situations: Publishing from a directory without git metadata; crates.io token expired or missing (`CARGO_REGISTRY_TOKEN`); version already published (409); offline CI environment blocking network access.

Related errors


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19). Data as JSON: /api/errors/5354d83faa8a57fb. Report an issue: GitHub.

Appendix: source

Thrown at tooling/xtask/src/tasks/gpui.rs:354

            .collect::<Vec<_>>()
            .join(" ");

        if args.is_empty() {
            program.to_string()
        } else {
            format!("{} {}", program, args)
        }
    };
    eprintln!("+ {}", command_str);

    let output = command
        .spawn()
        .context("failed to spawn child process")?
        .wait_with_output()
        .context("failed to wait for child process")?;

    if !output.status.success() {
        bail!("Command failed with status {}", output.status);
    }

    Ok(output)
}

#[cfg(test)]
mod tests {
    use indoc::indoc;

    use super::*;

    #[test]
    fn test_update_dependency_version_in_toml() {
        let input = indoc! {r#"
            [workspace]
            resolver = "2"

            [workspace.dependencies]

View on GitHub (pinned to 916fc2b8cb)