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
- Inspect what routing sees: pool size, worker availability status, and whether any worker's capabilities cover the task
- Scale the pool or wait for a worker to free up, then retry the task
- Register a worker whose capabilities/specialization match the failing task
- 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
- Size the pool above expected concurrency and monitor busy-worker ratios
- Keep a task queue in front of the pool so saturation becomes waiting, not errors
- Validate task capability requirements against registered workers at submit time
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
- Pool ${this.id} at maximum capacity (${this.config.maxWorker
- Circuit breaker is open. Service temporarily unavailable.
- maxConcurrency must be a positive integer
- duplicate or empty task id: ${task.id}
- Worker ${config.id} already exists in pool
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/d5454aef564a547f.
Report an issue: GitHub.