{"record":{"id":"89ee7f43ba652c81","repo":"ruvnet/ruflo","slug":"task-taskid-not-found","errorCode":null,"errorMessage":"Task ${taskId} not found","messagePattern":"Task (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/swarm/src/unified-coordinator.ts","lineNumber":1106,"sourceCode":"\n  getAgentPool(type: AgentType): AgentPool | undefined {\n    return this.agentPools.get(type);\n  }\n\n  // =============================================================================\n  // DOMAIN-BASED TASK ROUTING (15-Agent Hierarchy Support)\n  // =============================================================================\n\n  /**\n   * Assign a task to a specific domain\n   * Routes the task to the most suitable agent within that domain\n   */\n  async assignTaskToDomain(taskId: string, domain: AgentDomain): Promise<string | undefined> {\n    const startTime = performance.now();\n    const task = this.state.tasks.get(taskId);\n\n    if (!task) {\n      throw new Error(`Task ${taskId} not found`);\n    }\n\n    const pool = this.domainPools.get(domain);\n    if (!pool) {\n      throw new Error(`Domain pool ${domain} not found`);\n    }\n\n    // Try to acquire an agent from the domain pool\n    const agent = await pool.acquire();\n    if (!agent) {\n      // Add to domain queue if no agents available\n      const queue = this.domainTaskQueues.get(domain) || [];\n      queue.push(taskId);\n      this.domainTaskQueues.set(domain, queue);\n      task.status = 'queued';\n\n      this.emitEvent('task.queued', {\n        taskId,","sourceCodeStart":1088,"sourceCodeEnd":1124,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/unified-coordinator.ts#L1088-L1124","documentation":"assignTaskToDomain() looks the task up in state.tasks by exact id string; unknown ids throw before domain routing starts. Task ids are only valid within the same coordinator instance and only while the task still lives in the map, so replaying ids from another swarm or a previous run always fails.","triggerScenarios":"Calling assignTaskToDomain() with an id from a different swarm or coordinator, a completed-and-pruned task, or a hand-typed id; races where the task was cancelled between creation and assignment.","commonSituations":"Durable job queues replaying old ids against a fresh coordinator; typos in scripts; persisted task ids reused after a restart.","solutions":["Use the id returned by submitTask() on the same coordinator instance","Validate the id still exists in coordinator state before assigning to a domain","If tasks can be pruned, re-submit the task instead of replaying a stale id"],"exampleFix":"// before\nawait coordinator.assignTaskToDomain('task_oldswarm_1', 'development'); // throws: foreign id\n\n// after\nconst taskId = await coordinator.submitTask(taskData);\nawait coordinator.assignTaskToDomain(taskId, 'development');","handlingStrategy":"validation","validationCode":"// Track ids you created on this coordinator instance\nconst submitted = new Set<string>();\nconst id = await coordinator.submitTask(taskData);\nsubmitted.add(id);\n\nif (!submitted.has(taskId)) {\n  throw new Error(`Refusing to assign unknown task ${taskId}`);\n}\nawait coordinator.assignTaskToDomain(taskId, domain);","typeGuard":"function isSubmittedTaskId(taskId: string, submitted: Set<string>): taskId is string {\n  return submitted.has(taskId);\n}","tryCatchPattern":"try {\n  await coordinator.assignTaskToDomain(taskId, domain);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(`Task ${taskId} not found`)) {\n    const freshId = await coordinator.submitTask(taskData); // resubmit and route\n    return coordinator.assignTaskToDomain(freshId, domain);\n  }\n  throw err;\n}","preventionTips":["Treat task ids as ephemeral handles, not durable identifiers","Always capture and pass the submitTask() return value","Never replay recorded ids across coordinator restarts without resubmitting"],"tags":["unified-coordinator","task-routing","not-found","task-id"],"backgroundTag":"entity-not-found","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"}