{"record":{"id":"d0537265b254bb2e","repo":"Mintplex-Labs/anything-llm","slug":"command-aborted","errorCode":null,"errorMessage":"Command aborted","messagePattern":"Command aborted","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"open-computer/services/extensions/visible-bash.ts","lineNumber":187,"sourceCode":"          });\n        });\n\n        // Brief wait for output file to flush\n        await new Promise((r) => setTimeout(r, 100));\n\n        let output = \"\";\n        try {\n          output = readFileSync(outputFile, \"utf-8\");\n        } catch {}\n\n        let realExitCode = exitCode;\n        try {\n          const ecStr = readFileSync(exitCodeFile, \"utf-8\").trim();\n          if (ecStr) realExitCode = parseInt(ecStr, 10);\n        } catch {}\n\n        if (signal?.aborted) {\n          throw new Error(\n            output\n              ? `${truncateOutput(output)}\\n\\nCommand aborted`\n              : \"Command aborted\"\n          );\n        }\n\n        if (timedOut) {\n          throw new Error(\n            output\n              ? `${truncateOutput(output)}\\n\\nCommand timed out after ${timeout} seconds`\n              : `Command timed out after ${timeout} seconds`\n          );\n        }\n\n        const text = truncateOutput(output) || \"(no output)\";\n\n        if (realExitCode !== 0 && realExitCode !== null) {\n          throw new Error(`${text}\\n\\nCommand exited with code ${realExitCode}`);","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/open-computer/services/extensions/visible-bash.ts#L169-L205","documentation":"Thrown by the visible-bash extension when the wrapped terminal command was cancelled through the tool call's AbortSignal (signal.aborted is true after the spawned wrapper exits). The error message is the command's output captured so far (truncated) followed by 'Command aborted', or just 'Command aborted' if nothing was written. This is a deliberate cancellation path, not a crash of the extension.","triggerScenarios":"The agent runtime (pi-coding-agent) aborts the bash tool call mid-execution — e.g. the user hits escape/interrupt, the parent agent cancels the step, or a turn-level timeout aborts pending tool calls while the visible terminal is still running the command.","commonSituations":"User interrupts a long-running command; an orchestration layer cancels a subagent whose bash call is in flight; the desktop VM session is torn down while a command runs.","solutions":["Re-run the command if the work is still needed — check the partial output in the error to see how far it got","If aborts are frequent, run long work detached (nohup ... & echo $!) and poll the log file in separate short bash calls","Make commands idempotent/resumable (e.g. targets in make, --resume flags) so an abort is cheap"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { const out = await bash.run(cmd, { timeout }); } catch (e) { if (/Command aborted$/.test(e.message)) { /* cancellation: check partial output prefix, decide to re-run or skip */ return; } throw e; }","preventionTips":["Design long tasks as detached jobs plus polling calls so an abort never loses progress","Write partial state to files (logs, checkpoints) so aborted commands are resumable","Treat abort as control flow, not failure — don't auto-retry an aborted command without deciding it is still wanted"],"tags":["bash","abort","cancellation","tool-call","open-computer"],"backgroundTag":"aborted-signal","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}