{"record":{"id":"72528b48854c3369","repo":"can1357/oh-my-pi","slug":"outputtext-n-ncommand-failed-missing-exit-stat","errorCode":null,"errorMessage":"${outputText}\\n\\nCommand failed: missing exit status","messagePattern":"(.+?)\\\\n\\\\nCommand failed: missing exit status","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/bash.ts","lineNumber":667,"sourceCode":"\t\ttimeoutSec: number | undefined,\n\t\toutputText: string,\n\t): void {\n\t\tif (result.cancelled) {\n\t\t\t// Local executor output already carries a leading `[Command cancelled]`\n\t\t\t// notice from the sink; PTY/bridge output does not, so annotate only\n\t\t\t// the latter.\n\t\t\tconst out = normalizeResultOutput(result);\n\t\t\tconst annotated = out.startsWith(\"[Command cancelled]\") ? out : out ? `${out}\\n\\n[Command aborted]` : out;\n\t\t\tthrow new ToolError(annotated || \"Command aborted\");\n\t\t}\n\t\tif (result.timedOut === true) {\n\t\t\tconst out = normalizeResultOutput(result);\n\t\t\tconst message =\n\t\t\t\ttimeoutSec === undefined ? \"Command timed out\" : `Command timed out after ${timeoutSec} seconds`;\n\t\t\tthrow new ToolError(out ? `${out}\\n\\n[${message}]` : message);\n\t\t}\n\t\tif (result.exitCode === undefined) {\n\t\t\tthrow new ToolError(`${outputText}\\n\\nCommand failed: missing exit status`);\n\t\t}\n\t}\n\n\tasync #buildCompletedResult(\n\t\tresult: BashResult | BashInteractiveResult,\n\t\ttimeoutSec: number | undefined,\n\t\toptions: {\n\t\t\trequestedTimeoutSec?: number;\n\t\t\tnotices?: readonly string[];\n\t\t\tterminalId?: string;\n\t\t\twallTimeMs?: number;\n\t\t} = {},\n\t): Promise<AgentToolResult<BashToolDetails>> {\n\t\tconst exitCode = result.exitCode;\n\t\tconst failedExit = exitCode !== undefined && exitCode !== 0;\n\n\t\tconst outputLines = [this.#formatResultOutput(result)];\n\t\tconst notices: string[] = [];","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/bash.ts#L649-L685","documentation":"After a bash result that is neither success, cancelled, nor timed out, if result.exitCode is undefined BashTool throws this ToolError stating the process finished without an exit status. The captured outputText is included for debugging. This is a defensive path for executors that return no exit code.","triggerScenarios":"The executor returned a result where exitCode === undefined and timedOut/cancelled are not true — e.g. the process was killed by a signal the bridge didn't translate into an exit code, the PTY/bridge connection dropped, or an executor bug omitted exitCode.","commonSituations":"Process killed via SIGKILL/OOM through a code path that doesn't map signals to exit codes; infrastructure/PTY failures between the shell and the tool; custom executor implementations that don't always set exitCode.","solutions":["Rerun the command — a missing exit status is usually transient infrastructure loss, not a command error.","Check the captured output above the message for the real failure (OOM killer, crash, signal).","Inspect system logs (dmesg/journalctl) for OOM or signal kills of the shell process.","If using a custom executor/bridge, ensure it always reports a numeric exitCode (signal deaths can map to 128+signum)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await bash.run(cmd, opts); } catch (e) { if (e instanceof ToolError && e.message.includes('missing exit status')) { /* inspect outputText, check OOM/signals, retry once */ } else throw e; }","preventionTips":["Retry once on this transient infrastructure failure before surfacing it.","Monitor for OOM killer events if commands allocate heavily.","Use the built-in local executor, which reliably reports exit codes.","If implementing a custom executor, always map signal deaths to 128+signum exit codes."],"tags":["bash","exit-code","executor"],"backgroundTag":"missing-exit-status","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}