{"record":{"id":"6196714422cedcbf","repo":"Yeachan-Heo/oh-my-codex","slug":"task-taskid-not-found","errorCode":null,"errorMessage":"Task ${taskId} not found","messagePattern":"Task (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":4689,"sourceCode":"}\n\n/**\n * Assign a task to a worker by writing inbox and sending trigger.\n */\nexport async function assignTask(\n  teamName: string,\n  workerName: string,\n  taskId: string,\n  cwd: string,\n): Promise<void> {\n  const sanitized = sanitizeTeamName(teamName);\n  return await withTeamTaskMembershipBarrier(sanitized, cwd, async () => {\n    const phaseState = await readTeamPhaseState(sanitized, cwd);\n    if (phaseState?.terminal_epoch || (phaseState && isTerminalPhase(phaseState.current_phase))) {\n      throw new Error(teamContinuationRequiredDiagnostic(phaseState));\n    }\n    const task = await readTask(sanitized, taskId, cwd);\n    if (!task) throw new Error(`Task ${taskId} not found`);\n  const manifest = await readTeamManifestV2(sanitized, cwd);\n  const governance = resolveGovernancePolicy(manifest?.governance);\n\n  if (governance.delegation_only && workerName === 'leader-fixed') {\n    throw new Error('delegation_only_violation');\n  }\n\n  if (governance.plan_approval_required && task.requires_code_change === true) {\n    const approved = await isTaskApprovedForExecution(sanitized, taskId, cwd);\n    if (!approved) {\n      throw new Error('plan_approval_required');\n    }\n  }\n  const config = await readTeamConfig(sanitized, cwd);\n  if (!config) throw new Error(`Team ${sanitized} not found`);\n  const workerInfo = config.workers.find(w => w.name === workerName);\n  if (!workerInfo) throw new Error(`Worker ${workerName} not found in team`);\n  const dispatchPolicy = resolveDispatchPolicy(manifest?.policy, config.worker_launch_mode);","sourceCodeStart":4671,"sourceCodeEnd":4707,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L4671-L4707","documentation":"Thrown when readTask returns null for the given taskId during task assignment. The task record does not exist in the team's task store, so there is nothing to claim or dispatch.","triggerScenarios":"Calling the assignment function with a taskId that was never created, was deleted, or belongs to a different team (task files are scoped per team under the sanitized team name).","commonSituations":"Typos in task IDs; referencing tasks from a freshly recreated team whose task store was reset; race where the task was completed and archived between listing and assignment.","solutions":["Verify the taskId exists via readTask/listTasks for that team before assigning","If tasks were reset by team recreation, re-create the task or point at the correct team","Guard against races by re-checking task existence right before dispatch"],"exampleFix":"// before\nawait assignTask(team, 'T-42', worker, cwd);\n\n// after\nconst task = await readTask(team, 'T-42', cwd);\nif (!task) throw new Error(`Unknown task T-42; run team task list to refresh IDs`);\nawait assignTask(team, 'T-42', worker, cwd);","handlingStrategy":"validation","validationCode":"const task = await readTask(teamName, taskId, cwd);\nif (!task) throw new Error(`Unknown task ${taskId}`);","typeGuard":null,"tryCatchPattern":"try { await assignTask(t, id, w, cwd); } catch (e) { if ((e as Error).message === `Task ${id} not found`) await refreshTaskList(t); else throw e; }","preventionTips":["Fetch task IDs programmatically from listTasks instead of hardcoding","Re-validate task existence right before dispatch","Scope task IDs per team; do not share IDs across teams"],"tags":["task","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}