earendil-works/pi · error
Command exited with code
Error message
Command exited with code ${exitCode} What it means
Signal rethrow in the bash tool's exec path: the shell backend threw the literal 'aborted' error because the AbortSignal fired (user pressed the abort key or the session is shutting down). The wrapper appends 'Command aborted' to the output text accumulated before cancellation so partial stdout/stderr is preserved.
Solutions
- No fix needed: this reports cancellation, not a command failure
- Rerun the command if you still need its result
- Avoid aborting signals for commands whose completion matters
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/coding-agent/src/core/tools/bash.ts:457 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/8f136b52617650fe.
Report an issue: GitHub.
Appendix: source
Thrown at packages/coding-agent/src/core/tools/bash.ts:457
});
exitCode = result.exitCode;
} catch (err) {
const snapshot = await finishOutput();
const { text } = formatOutput(snapshot, "");
if (err instanceof Error && err.message === "aborted") {
throw new Error(appendStatus(text, "Command aborted"));
}
if (err instanceof Error && err.message.startsWith("timeout:")) {
const timeoutSecs = err.message.split(":")[1];
throw new Error(appendStatus(text, `Command timed out after ${timeoutSecs} seconds`));
}
throw err;
}
const snapshot = await finishOutput();
const { text: outputText, details } = formatOutput(snapshot);
if (exitCode !== 0 && exitCode !== null) {
throw new Error(appendStatus(outputText, `Command exited with code ${exitCode}`));
}
return { content: [{ type: "text", text: outputText }], details };
} finally {
clearUpdateTimer();
}
},
renderCall(args, _theme, context) {
const state = context.state;
if (context.executionStarted && state.startedAt === undefined) {
state.startedAt = Date.now();
state.endedAt = undefined;
}
const text = (context.lastComponent as Text | undefined) ?? new Text("", 0, 0);
text.setText(formatBashCall(args));
return text;
},
renderResult(result, options, _theme, context) {
const state = context.state;View on GitHub (pinned to 4af9d21d3b)