ruvnet/ruflo · error · Error

No available workers for task

Error message

No available workers for task

What it means

executeTask() asked routeTask() for the best worker and got none back — the pool has no live workers matching the task's routing criteria (all shut down, or none of the right type). With no executor to hand the task to, the call fails immediately.

Source

Thrown at v3/@claude-flow/integration/src/worker-pool.ts:602

      tasksProcessed: this.poolMetrics.tasksProcessed,
      tasksFailed: this.poolMetrics.tasksFailed,
      avgTaskDuration,
      workerTypes,
      uptime: Date.now() - this.createdAt,
    };
  }

  /**
   * Execute a task on the best available worker
   *
   * @param task - Task to execute
   * @returns Task result
   */
  async executeTask(task: Task): Promise<TaskResult> {
    const workers = this.routeTask(task, 1);

    if (workers.length === 0) {
      throw new Error('No available workers for task');
    }

    const worker = workers[0];
    const startTime = Date.now();

    try {
      const result = await worker.executeTask(task);

      // Update pool metrics
      this.poolMetrics.tasksProcessed++;
      this.poolMetrics.totalTaskDuration += result.duration;

      if (!result.success) {
        this.poolMetrics.tasksFailed++;
      }

      return result;
    } catch (error) {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Inspect what routing sees: pool size, worker availability status, and whether any worker's capabilities cover the task
  2. Scale the pool or wait for a worker to free up, then retry the task
  3. Register a worker whose capabilities/specialization match the failing task
  4. Queue tasks upstream instead of failing fast when the pool can saturate

Example fix

// before
const result = await pool.executeTask(task); // throws when all workers busy

// after
let result;
for (let i = 0; i < 5; i++) {
  if (pool.routeTask(task, 1).length > 0) {
    result = await pool.executeTask(task);
    break;
  }
  await sleep(100 * 2 ** i); // wait for a worker to free up
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-route before committing to execution
const candidates = pool.routeTask(task, 1);
if (candidates.length === 0) {
  await sleep(250); // or enqueue upstream instead of failing
}

Type guard

const hasRouteForTask = (pool: WorkerPool, t: Task): boolean =>
  pool.routeTask(t, 1).length > 0;

Try / catch

try {
  await pool.executeTask(task);
} catch (e) {
  if (e instanceof Error && e.message === 'No available workers for task') {
    // transient saturation: exponential-backoff retry with a max, then dead-letter
  }
  throw e;
}

Prevention

When it happens

Trigger: Dispatching when the pool is empty, all matching workers are at capacity or still initializing, or no registered worker's type/capabilities/specialization match what the task requires.

Common situations: A burst arriving while every worker is busy; a pool populated with the wrong worker types; workers not yet initialized after a mass spawn; a task requiring a capability nobody registered.

Related errors


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