ruvnet/ruflo · error · Error

Can only resume paused agent

Error message

Can only resume paused agent

What it means

Agent.resume() is only valid from the 'paused' state. This throw fires when resume() is called on an agent that is idle, active, busy, error, or terminated — i.e., there is nothing paused to resume.

Source

Thrown at v3/@claude-flow/swarm/src/domain/entities/agent.ts:205

  }

  /**
   * Pause the agent
   */
  pause(): void {
    if (this._status !== 'active' && this._status !== 'busy') {
      throw new Error('Can only pause active or busy agent');
    }
    this._status = 'paused';
    this._updatedAt = new Date();
  }

  /**
   * Resume paused agent
   */
  resume(): void {
    if (this._status !== 'paused') {
      throw new Error('Can only resume paused agent');
    }
    this._status = this._currentTaskIds.size > 0 ? 'busy' : 'active';
    this._lastActiveAt = new Date();
    this._updatedAt = new Date();
  }

  /**
   * Terminate the agent
   */
  terminate(): void {
    this._status = 'terminated';
    this._currentTaskIds.clear();
    this._updatedAt = new Date();
  }

  /**
   * Mark agent as having an error
   */

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Gate on agent.status === 'paused' before resume() If the agent is 'idle', use start() instead; if 'error', use recover() then start() Persist the pre-shutdown state and replay the correct transition on boot Make resume idempotent in the calling layer

Example fix

// before
agents.forEach(a => a.resume()); // throws for non-paused

// after
for (const a of agents) {
  if (a.status === 'paused') a.resume();
  else if (a.status === 'idle') a.start();
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (agent.status === 'paused') agent.resume();
else if (agent.status === 'idle') agent.start(); // common intent when people misuse resume()

Type guard

function isResumable(a) { return a.status === 'paused'; }

Try / catch

try { agent.resume(); }
catch (e) {
  if (e instanceof Error && e.message === 'Can only resume paused agent') return;
  throw e;
}

Prevention

When it happens

Trigger: Calling resume() on a freshly created (idle) agent that was never started or paused Double resume() (second call sees 'active'/'busy') Resuming an agent that errored while paused-adjacent workflows ran Generic 'resume all' routines run after a crash where agents were never actually paused

Common situations: Startup scripts that call resume() on rehydrated agents regardless of persisted status UI resume controls not gated on the paused state Coordinator restart logic resuming agents that were stopped via terminate() instead of pause()

Related errors


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