{"record":{"id":"4d4e138fc7ab0da0","repo":"earendil-works/pi","slug":"command-exited-with-code-capture-exitcode","errorCode":null,"errorMessage":"Command exited with code ${capture.exitCode}","messagePattern":"Command exited with code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/agent/src/harness/tools/bash.ts","lineNumber":153,"sourceCode":"\t\t\t\t\t\tconst lastLineSize = formatSize(capture.lastLineBytes);\n\t\t\t\t\t\toutputText += `\\n\\n[Showing last ${formatSize(capture.truncation.outputBytes)} of line ${endLine} (line is ${lastLineSize}). Full output: ${capture.fullOutputPath}]`;\n\t\t\t\t\t} else if (capture.truncation.truncatedBy === \"lines\") {\n\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLine}-${endLine} of ${capture.truncation.totalLines}. Full output: ${capture.fullOutputPath}]`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\toutputText += `\\n\\n[Showing lines ${startLine}-${endLine} of ${capture.truncation.totalLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Full output: ${capture.fullOutputPath}]`;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst appendStatus = (status: string): string => `${outputText ? `${outputText}\\n\\n` : \"\"}${status}`;\n\t\t\t\tif (capture.cancelled) throw new Error(appendStatus(\"Command aborted\"));\n\t\t\t\tif (capture.executionError?.code === \"timeout\") {\n\t\t\t\t\tthrow new Error(appendStatus(`Command timed out after ${timeout} seconds`), {\n\t\t\t\t\t\tcause: capture.executionError,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (capture.executionError) throw capture.executionError;\n\t\t\t\tif (capture.exitCode !== 0 && capture.exitCode !== undefined) {\n\t\t\t\t\tthrow new Error(appendStatus(`Command exited with code ${capture.exitCode}`));\n\t\t\t\t}\n\t\t\t\treturn { content: [{ type: \"text\", text: outputText || \"(no output)\" }], details };\n\t\t\t} finally {\n\t\t\t\tclearUpdateTimer();\n\t\t\t}\n\t\t},\n\t};\n}\n","sourceCodeStart":135,"sourceCodeEnd":162,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/agent/src/harness/tools/bash.ts#L135-L162","documentation":"Error \"Command exited with code ${capture.exitCode}\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/agent/src/harness/tools/bash.ts:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the command output and stderr, fix the failing command, and re-run it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}