zed-industries/zed · error
Build failed
Error message
Build failed
What it means
When a debug scenario declares a `build` task, Zed runs it in a terminal panel and awaits `wait_for_completed_task`; a non-success exit status aborts the debug session with plain `Build failed` (running.rs:1230). The build output itself is in the terminal, not in the error — the error only signals the exit code.
Solutions
- Run the exact same build task manually (Zed task runner or terminal) and fix the reported errors — the failure reason is in that terminal output.
- Check the build task's `command` and `cwd` match how you build the project outside Zed.
- Confirm the toolchain (cargo/make/npm/go) is on PATH in the environment Zed inherits; launch Zed from a shell with the right env if needed.
- If the failure was a cancelled/timeout run, simply rerun the debug scenario.
Defensive patterns
Strategy: try-catch
Validate before calling
# run the build standalone before starting the debug scenario ./script/build || echo "fix build errors first — the debug session would abort with 'Build failed'"
Try / catch
Catch the non-success exit and attach the terminal's task context (task name, exit code, signal) to the error so the user can jump straight to the failing output; do not swallow and continue to the debug session.
Prevention
- Keep build tasks green before debugging; run them standalone after edits.
- Pin correct cwd and PATH in the build task definition.
- Treat intermittent signal-killed builds as environment issues (OOM) and investigate, not retry blindly.
When it happens
Trigger: The scenario's build command (cargo build, make, npm run build, go build, …) exits non-zero, is killed by a signal (SIGKILL/OOM, Ctrl-C in the terminal), or the command fails to even start correctly inside the terminal task (wrong cwd, missing binary in PATH).
Common situations: Compile errors at debug time; wrong working directory for the build task; toolchain not installed in the environment Zed spawns; builds cancelled mid-run; flaky builds that fail intermittently.
Related errors
- Cannot have two different hosts in debug configuration
- Cannot have two different ports in debug configuration
- Could not resolve task variables within a debug scenario
- DAP returned IPv6 host
- debug config not found in mode
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/77921f1e92918b2f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/debugger_ui/src/session/running.rs:1230
cx,
)
})?;
this.update_in(cx, |this, window, cx| {
this.ensure_pane_item(DebuggerPaneItem::Terminal, window, cx);
this.debug_terminal.update(cx, |debug_terminal, cx| {
debug_terminal.terminal = Some(terminal_view);
cx.notify();
});
})?;
let exit_status = terminal
.read_with(cx, |terminal, cx| terminal.wait_for_completed_task(cx))
.await
.context("Failed to wait for completed task")?;
if !exit_status.success() {
anyhow::bail!("Build failed");
}
Some((task.resolved.clone(), locator_name, extra_config))
} else {
None
};
if config_is_valid {
} else if let Some((task, locator_name, extra_config)) = build_output {
let locator_name =
locator_name.with_context(|| {
format!("Could not find a valid locator for a build task and configure is invalid with error: {}", request_type.err()
.map(|err| err.to_string())
.unwrap_or_default())
})?;
let request = dap_store
.update(cx, |this, cx| {
this.run_debug_locator(&locator_name, task, cx)
})?View on GitHub (pinned to f4178619ac)