{"record":{"id":"d09fd0f78e4473d7","repo":"can1357/oh-my-pi","slug":"command-timed-out-d09fd0","errorCode":null,"errorMessage":"Command timed out","messagePattern":"Command timed out","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/bash.ts","lineNumber":1225,"sourceCode":"\t\t\t\tif (createRaced.kind === \"aborted\" || signal?.aborted) {\n\t\t\t\t\tcleanupLateCreate(createP);\n\t\t\t\t\tthrow new ToolAbortError(\"Command aborted\");\n\t\t\t\t}\n\t\t\t\tif (createRaced.kind === \"timeout\") {\n\t\t\t\t\tcleanupLateCreate(createP);\n\t\t\t\t\tconst timedOutResult: BashInteractiveResult = {\n\t\t\t\t\t\toutput: \"\",\n\t\t\t\t\t\texitCode: undefined,\n\t\t\t\t\t\tcancelled: false,\n\t\t\t\t\t\ttimedOut: true,\n\t\t\t\t\t\ttruncated: false,\n\t\t\t\t\t\ttotalLines: 0,\n\t\t\t\t\t\ttotalBytes: 0,\n\t\t\t\t\t\toutputLines: 0,\n\t\t\t\t\t\toutputBytes: 0,\n\t\t\t\t\t};\n\t\t\t\t\tthis.#throwIfUnfinished(timedOutResult, timeoutSec, this.#formatResultOutput(timedOutResult));\n\t\t\t\t\tthrow new ToolError(\"Command timed out\");\n\t\t\t\t}\n\n\t\t\t\thandle = createRaced.handle;\n\n\t\t\t\t// Emit partial update so the editor can embed the live terminal card.\n\t\t\t\tonUpdate?.({ content: [], details: { terminalId: handle.terminalId } });\n\n\t\t\t\tconst exitPromise = handle.waitForExit();\n\t\t\t\tlet exitStatus!: ClientBridgeTerminalExitStatus;\n\n\t\t\t\ttype BridgeRaceResult =\n\t\t\t\t\t| { kind: \"exit\"; status: ClientBridgeTerminalExitStatus }\n\t\t\t\t\t| { kind: \"poll\" }\n\t\t\t\t\t| { kind: \"timeout\" }\n\t\t\t\t\t| { kind: \"aborted\" };\n\n\t\t\t\tconst exitRacer = exitPromise.then(status => ({ kind: \"exit\" as const, status }));\n\t\t\t\tconst abortRacer = abortedP.then(() => ({ kind: \"aborted\" as const }));","sourceCodeStart":1207,"sourceCodeEnd":1243,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/bash.ts#L1207-L1243","documentation":"BashTool enforces a wall-clock timeout on commands it runs. When the spawned command does not exit within the requested timeoutSec, the tool kills the process and throws ToolError(\"Command timed out\") instead of returning a result. This surfaces the timeout to the agent so it can retry with a longer timeout, run the command in the background, or split the work.","triggerScenarios":"Running a command via the bash tool whose execution time exceeds the timeout passed to the execute call (or the session default). The raced timeout promise wins over the exit promise, the process is killed, and this error is thrown.","commonSituations":"Long builds (npm install, cargo build), commands that wait on user input (prompts), network operations on slow connections, accidentally interactive commands (editors, password prompts), and daemon-style commands that never exit (servers started in foreground).","solutions":["Increase the timeout parameter on the bash tool call","Run long-lived or slow commands in the background (nohup ... &) and poll output instead","Split the work into smaller commands that each finish within the timeout","Ensure the command is non-interactive (pass flags like -y, pipe stdin, set CI=1)","Check for accidental blocking on stdin/prompt and redirect </dev/null"],"exampleFix":"// before\nawait bash.execute(\"npm run build\"); // default timeout, big build times out\n// after\nawait bash.execute(\"npm run build\", { timeout: 600 });","handlingStrategy":"try-catch","validationCode":"// estimate: skip the call if the command classically exceeds budget\nconst LONG = /^(npm (install|run (build|test))|cargo build|docker build)/;\nif (LONG.test(cmd)) console.warn(\"use an elevated timeout or background this command\");","typeGuard":null,"tryCatchPattern":"try {\n  const res = await bash.execute(cmd, { timeout: 300 });\n} catch (e) {\n  if (e instanceof ToolError && e.message === \"Command timed out\") {\n    // retry with larger timeout or background the command\n  } else throw e;\n}","preventionTips":["Always set an explicit timeout sized to the command","Background long-running daemons instead of running them in the foreground","Make commands non-interactive (flags, CI env vars, </dev/null)","Split long work into chunks under the timeout"],"tags":["timeout","bash","process"],"backgroundTag":"command-timeout","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}