Yeachan-Heo/oh-my-codex · error · Error

Team ${sanitized} not found

Error message

Team ${sanitized} not found

What it means

Thrown when readTeamConfig returns null during task assignment — the team's config file does not exist or is unreadable, so the team is treated as not found.

Source

Thrown at src/team/runtime.ts:4704

      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);

  const claim = await claimTask(sanitized, taskId, workerName, task.version ?? 1, cwd);
  if (!claim.ok) {
    if (claim.error === 'blocked_dependency') {
      throw new Error(`blocked_dependency:${(claim.dependencies ?? []).join(',')}`);
    }
    throw new Error(claim.error);
  }

  try {
    // Retry dispatch up to 2 times to handle trust prompts during assignment (fixes #393).
    const approvedExecutionState = await resolvePersistedApprovedTeamExecutionContinuityState(
      sanitized,
      config.leader_cwd ?? cwd,
      config.team_state_root ?? resolveCanonicalTeamStateRoot(config.leader_cwd ?? cwd),

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Verify the team name matches an existing team (list teams) and that its config file exists under the expected state root
  2. Create/initialize the team before assigning tasks
  3. Ensure cwd is the project directory the team belongs to

Example fix

// before
await assignTask('myteam', taskId, worker, cwd);

// after
const config = await readTeamConfig(sanitizeTeamName('myteam'), cwd);
if (!config) throw new Error('team myteam does not exist; run team create first');
await assignTask('myteam', taskId, worker, cwd);
Defensive patterns

Strategy: validation

Validate before calling

const config = await readTeamConfig(sanitizeTeamName(teamName), cwd);
if (!config) throw new Error(`team ${teamName} not initialized`);

Try / catch

try { await fn(teamName, cwd); } catch (e) { if ((e as Error).message.endsWith('not found')) await createTeam(teamName, cwd); else throw e; }

Prevention

When it happens

Trigger: Calling any task-assignment API for a team whose config is missing: wrong team name (after sanitization), team never created, or the team's state directory/config file was deleted.

Common situations: Typo in the team name; running from the wrong cwd so the team state root resolves elsewhere; team state wiped by cleanup scripts or a fresh clone without team state.

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


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/b1dcd7e5eba15a79. Report an issue: GitHub.