ruvnet/ruflo · warning

Task aborted

Error message

Task aborted

What it means

Thrown inside LongRunningWorker#executeCore (v3/@claude-flow/integration/src/long-running-worker.ts:656) at each phase boundary when this.isAborted() is true — i.e. the task's AbortController was triggered via the worker's abort API. It is cooperative cancellation: the default phase loop checks the abort flag between the initialization/processing/finalization phases and stops by throwing.

Source

Thrown at v3/@claude-flow/integration/src/long-running-worker.ts:656

  /**
   * Core execution logic
   *
   * Override this in subclasses for custom long-running task implementations.
   *
   * @param task - Task to execute
   * @returns Execution output
   */
  protected async executeCore(task: Task): Promise<AgentOutput> {
    // Default implementation with standard execution phases
    const phases: ExecutionPhase[] = [
      { name: 'initialization', estimatedSteps: 1 },
      { name: 'processing', estimatedSteps: 5 },
      { name: 'finalization', estimatedSteps: 1 },
    ];

    for (const phase of phases) {
      if (this.isAborted()) {
        throw new Error('Task aborted');
      }

      for (let step = 1; step <= phase.estimatedSteps; step++) {
        this.updateState(phase.name, step, phase.estimatedSteps);

        // Phase processing time
        await this.delay(100);

        // Add partial result
        this.updateState(phase.name, step, phase.estimatedSteps, {
          phase: phase.name,
          step,
          timestamp: Date.now(),
        });
      }
    }

    return {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Treat 'Task aborted' as expected control flow: catch it and distinguish cancellation from real failures (check isAborted() or the abort reason) instead of reporting a crash.
  2. Do not resume or reuse aborted work blindly — restart from the last checkpoint if you saved one.
  3. For deadline-based aborts, surface 'cancelled by timeout' to callers rather than a raw error.
  4. If abort was unexpected, find who called abort()/signalled the AbortController (supervisor, timeout, shutdown hook).

Example fix

// before
const out = await worker.execute(task);

// after
try {
  const out = await worker.execute(task);
} catch (e) {
  if ((e as Error).message === 'Task aborted') {
    return { status: 'cancelled' };
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (worker.isAborted?.()) {
  // cancellation already requested: skip dispatch or return early
  return { status: 'cancelled' };
}

Type guard

function isAbortError(e: unknown): e is Error {
  return e instanceof Error && e.message === 'Task aborted';
}

Try / catch

try {
  out = await worker.execute(task);
} catch (e) {
  if (isAbortError(e)) {
    return { status: 'cancelled', reason: 'aborted by caller' }; // expected control flow
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling worker.abort(taskId) (or the configured abort entry point) while executeCore is between phases; timeouts built on abort; a supervisor cancelling long tasks on shutdown; aborting twice so a second run also sees the flag.

Common situations: User cancels a long-running job from the UI; a deadline timer fires abort; graceful shutdown aborting in-flight tasks; tests that abort and then assert on the rejection without recognizing this message.

Related errors


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/66f67a3b67f137d9. Report an issue: GitHub.