Mintplex-Labs/anything-llm · info · Error

Command aborted

Error message

Command aborted

What it means

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.

Solutions

  1. Re-run the command if the work is still needed — check the partial output in the error to see how far it got
  2. If aborts are frequent, run long work detached (nohup ... & echo $!) and poll the log file in separate short bash calls
  3. Make commands idempotent/resumable (e.g. targets in make, --resume flags) so an abort is cheap
Defensive patterns

Strategy: try-catch

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/d0537265b254bb2e. Report an issue: GitHub.

Appendix: source

Thrown at open-computer/services/extensions/visible-bash.ts:187

          });
        });

        // Brief wait for output file to flush
        await new Promise((r) => setTimeout(r, 100));

        let output = "";
        try {
          output = readFileSync(outputFile, "utf-8");
        } catch {}

        let realExitCode = exitCode;
        try {
          const ecStr = readFileSync(exitCodeFile, "utf-8").trim();
          if (ecStr) realExitCode = parseInt(ecStr, 10);
        } catch {}

        if (signal?.aborted) {
          throw new Error(
            output
              ? `${truncateOutput(output)}\n\nCommand aborted`
              : "Command aborted"
          );
        }

        if (timedOut) {
          throw new Error(
            output
              ? `${truncateOutput(output)}\n\nCommand timed out after ${timeout} seconds`
              : `Command timed out after ${timeout} seconds`
          );
        }

        const text = truncateOutput(output) || "(no output)";

        if (realExitCode !== 0 && realExitCode !== null) {
          throw new Error(`${text}\n\nCommand exited with code ${realExitCode}`);

View on GitHub (pinned to 3aec848f28)