can1357/oh-my-pi · error · Error
Command timed out after ${err.message.slice("timeout:".lengt
Error message
Command timed out after ${err.message.slice("timeout:".length)} seconds What it means
The legacy bash command exceeded its configured timeout and was killed. The underlying spawn rejects with a message of the form 'timeout:N'; this handler rewrites it into a user-friendly 'Command timed out after N seconds' message, preserving captured output.
Source
Thrown at packages/coding-agent/src/extensibility/legacy-pi-coding-agent-shim.ts:394
onData,
signal,
timeout,
env: spawn.env,
});
const snapshot = legacyBashSnapshot(output);
const text = snapshot.text || "(no output)";
if (result.exitCode !== 0 && result.exitCode !== null) {
throw new Error(appendStatus(text, `Command exited with code ${result.exitCode}`));
}
return { content: [{ type: "text", text }], details: snapshot.details };
} catch (err) {
const snapshot = legacyBashSnapshot(output);
const text = snapshot.text;
if (err instanceof Error && err.message === "aborted") {
throw new Error(appendStatus(text, "Command aborted"));
}
if (err instanceof Error && err.message.startsWith("timeout:")) {
throw new Error(appendStatus(text, `Command timed out after ${err.message.slice("timeout:".length)} seconds`));
}
throw err;
}
}
/**
* Convert an image attachment to PNG using the legacy package-root contract.
*
* Invalid or unsupported image data returns `null`, matching Pi's historical
* helper instead of surfacing Bun's decoder error to extensions.
*/
export async function convertToPng(
base64Data: string,
mimeType: string,
): Promise<{ data: string; mimeType: string } | null> {
if (mimeType === "image/png") {
return { data: base64Data, mimeType };
}View on GitHub (pinned to 9690622007)
Solutions
- Increase the timeout option when creating/invoking the bash tool
- Fix the command so it completes (remove interactive prompts, add input redirection)
- Run genuinely long work in the background and poll it
- Capture the partial output in the error to see how far the command got
Example fix
// before
createBashToolDefinition(cwd, { timeout: 10 });
// after
createBashToolDefinition(cwd, { timeout: 120 }); Defensive patterns
Strategy: retry
Validate before calling
// estimate worst-case runtime and compare against the configured timeout before running
if (estimatedSeconds >= timeoutSeconds) throw new Error('command will exceed configured timeout; raise timeout or background it'); Type guard
function isTimeout(e: unknown): boolean { return e instanceof Error && e.message.includes('Command timed out after'); } Try / catch
try { await bashTool.execute({ command }); } catch (err) {
if (err instanceof Error && err.message.includes('Command timed out after')) {
const secs = Number(err.message.match(/after (\d+) seconds/)?.[1]);
return retryWith({ timeout: secs * 4 });
}
throw err;
} Prevention
- Set timeouts above realistic worst-case runtimes for the commands your agent issues
- Redirect stdin (/dev/null) so commands never block waiting for input
- Background long jobs and poll instead of relying on a single long call
- Parse the 'timed out after N seconds' message to size retry timeouts
When it happens
Trigger: executeLegacyBashOperations runs a command whose runtime exceeds the timeout passed to the spawn (err.message starts with 'timeout:'); the process is killed and this error is thrown.
Common situations: Long builds, installs, or interactive commands that never terminate; timeout set too low in tool options; commands waiting on stdin in non-interactive contexts.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Command exited with code ${result.exitCode}
- Command timed out
- Command aborted
- Failed to restart ${serverName}: server process did not exit
- ${out}\n\n[${message}]
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/6eaa611530ab42b5.
Report an issue: GitHub.