{"record":{"id":"d5454aef564a547f","repo":"ruvnet/ruflo","slug":"no-available-workers-for-task","errorCode":null,"errorMessage":"No available workers for task","messagePattern":"No available workers for task","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/integration/src/worker-pool.ts","lineNumber":602,"sourceCode":"      tasksProcessed: this.poolMetrics.tasksProcessed,\n      tasksFailed: this.poolMetrics.tasksFailed,\n      avgTaskDuration,\n      workerTypes,\n      uptime: Date.now() - this.createdAt,\n    };\n  }\n\n  /**\n   * Execute a task on the best available worker\n   *\n   * @param task - Task to execute\n   * @returns Task result\n   */\n  async executeTask(task: Task): Promise<TaskResult> {\n    const workers = this.routeTask(task, 1);\n\n    if (workers.length === 0) {\n      throw new Error('No available workers for task');\n    }\n\n    const worker = workers[0];\n    const startTime = Date.now();\n\n    try {\n      const result = await worker.executeTask(task);\n\n      // Update pool metrics\n      this.poolMetrics.tasksProcessed++;\n      this.poolMetrics.totalTaskDuration += result.duration;\n\n      if (!result.success) {\n        this.poolMetrics.tasksFailed++;\n      }\n\n      return result;\n    } catch (error) {","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/integration/src/worker-pool.ts#L584-L620","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst result = await pool.executeTask(task); // throws when all workers busy\n\n// after\nlet result;\nfor (let i = 0; i < 5; i++) {\n  if (pool.routeTask(task, 1).length > 0) {\n    result = await pool.executeTask(task);\n    break;\n  }\n  await sleep(100 * 2 ** i); // wait for a worker to free up\n}","handlingStrategy":"retry","validationCode":"// Pre-route before committing to execution\nconst candidates = pool.routeTask(task, 1);\nif (candidates.length === 0) {\n  await sleep(250); // or enqueue upstream instead of failing\n}","typeGuard":"const hasRouteForTask = (pool: WorkerPool, t: Task): boolean =>\n  pool.routeTask(t, 1).length > 0;","tryCatchPattern":"try {\n  await pool.executeTask(task);\n} catch (e) {\n  if (e instanceof Error && e.message === 'No available workers for task') {\n    // transient saturation: exponential-backoff retry with a max, then dead-letter\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["worker-pool","routing","availability","saturation"],"backgroundTag":"no-available-workers","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}