Yeachan-Heo/oh-my-codex · error · Error
Task ${taskId} not found
Error message
Task ${taskId} not found What it means
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.
Source
Thrown at src/team/runtime.ts:4689
}
/**
* Assign a task to a worker by writing inbox and sending trigger.
*/
export async function assignTask(
teamName: string,
workerName: string,
taskId: string,
cwd: string,
): Promise<void> {
const sanitized = sanitizeTeamName(teamName);
return await withTeamTaskMembershipBarrier(sanitized, cwd, async () => {
const phaseState = await readTeamPhaseState(sanitized, cwd);
if (phaseState?.terminal_epoch || (phaseState && isTerminalPhase(phaseState.current_phase))) {
throw new Error(teamContinuationRequiredDiagnostic(phaseState));
}
const task = await readTask(sanitized, taskId, cwd);
if (!task) throw new Error(`Task ${taskId} not found`);
const manifest = await readTeamManifestV2(sanitized, cwd);
const governance = resolveGovernancePolicy(manifest?.governance);
if (governance.delegation_only && workerName === 'leader-fixed') {
throw new Error('delegation_only_violation');
}
if (governance.plan_approval_required && task.requires_code_change === true) {
const approved = await isTaskApprovedForExecution(sanitized, taskId, cwd);
if (!approved) {
throw new Error('plan_approval_required');
}
}
const config = await readTeamConfig(sanitized, cwd);
if (!config) throw new Error(`Team ${sanitized} not found`);
const workerInfo = config.workers.find(w => w.name === workerName);
if (!workerInfo) throw new Error(`Worker ${workerName} not found in team`);
const dispatchPolicy = resolveDispatchPolicy(manifest?.policy, config.worker_launch_mode);View on GitHub (pinned to 3ad79a8a6f)
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
Example fix
// before await assignTask(team, 'T-42', worker, cwd); // after const task = await readTask(team, 'T-42', cwd); if (!task) throw new Error(`Unknown task T-42; run team task list to refresh IDs`); await assignTask(team, 'T-42', worker, cwd);
Defensive patterns
Strategy: validation
Validate before calling
const task = await readTask(teamName, taskId, cwd);
if (!task) throw new Error(`Unknown task ${taskId}`); Try / catch
try { await assignTask(t, id, w, cwd); } catch (e) { if ((e as Error).message === `Task ${id} not found`) await refreshTaskList(t); else throw e; } Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- agents-init target not found: ${requestedTarget}
- agent not found: ${normalized}
- No mission task found for --task ${parsed.taskId}.
- Team ${sanitized} not found
- Worker ${workerName} not found in team
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/6196714422cedcbf.
Report an issue: GitHub.