{"record":{"id":"b5ca75932df6bd78","repo":"ruvnet/ruflo","slug":"cannot-assign-task-with-status-task-status","errorCode":null,"errorMessage":"Cannot assign task with status: ${task.status}","messagePattern":"Cannot assign task with status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/mcp/tools/task-tools.ts","lineNumber":630,"sourceCode":"  if (!task) {\n    throw new Error(`Task not found: ${input.taskId}`);\n  }\n\n  const previousAgent = task.assignedTo;\n\n  // Check if task can be assigned\n  if (task.assignedTo && !input.reassign) {\n    return {\n      taskId: input.taskId,\n      agentId: input.agentId,\n      assigned: false,\n      assignedAt,\n      previousAgent,\n    };\n  }\n\n  if (task.status === 'completed' || task.status === 'cancelled' || task.status === 'failed') {\n    throw new Error(`Cannot assign task with status: ${task.status}`);\n  }\n\n  // Assign the task\n  task.assignedTo = input.agentId;\n  task.status = 'assigned';\n  task.updatedAt = assignedAt;\n\n  return {\n    taskId: input.taskId,\n    agentId: input.agentId,\n    assigned: true,\n    assignedAt,\n    previousAgent,\n  };\n}\n\n/**\n * Update task properties","sourceCodeStart":612,"sourceCodeEnd":648,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/mcp/tools/task-tools.ts#L612-L648","documentation":"handleAssignTask found the task but its status is terminal — 'completed', 'cancelled', or 'failed'. Assigning work to a finished task is an invalid state transition, so the assignment is refused and the offending status is included in the message.","triggerScenarios":"Thrown at v3/mcp/tools/task-tools.ts:630 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Only assign tasks in a pending or queued status.","Reset or recreate the task if it is in a terminal state."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}