{"record":{"id":"0ce5f858cc558f3d","repo":"Yeachan-Heo/oh-my-codex","slug":"unknown-team-phase-exhaustive","errorCode":null,"errorMessage":"Unknown team phase: ${_exhaustive}","messagePattern":"Unknown team phase: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/orchestrator.ts","lineNumber":138,"sourceCode":"\n/**\n * Get agent roles recommended for each phase\n */\nexport function getPhaseAgents(phase: TeamPhase): string[] {\n  switch (phase) {\n    case 'team-plan':\n      return ['analyst', 'planner'];\n    case 'team-prd':\n      return ['product-manager', 'analyst'];\n    case 'team-exec':\n      return ['executor', 'designer', 'test-engineer'];\n    case 'team-verify':\n      return ['verifier', 'code-reviewer', 'quality-reviewer'];\n    case 'team-fix':\n      return ['executor', 'debugger', 'test-engineer'];\n    default: {\n      const _exhaustive: never = phase;\n      throw new Error(`Unknown team phase: ${_exhaustive}`);\n    }\n  }\n}\n\n/**\n * Generate phase instructions for AGENTS.md context\n */\nexport function getPhaseInstructions(phase: TeamPhase): string {\n  switch (phase) {\n    case 'team-plan':\n      return 'PHASE: Planning. Use /analyst for requirements, /planner for task breakdown. Output: task list with dependencies.';\n    case 'team-prd':\n      return 'PHASE: Requirements. Use /product-manager for PRD, /analyst for acceptance criteria. Output: explicit scope and success metrics.';\n    case 'team-exec':\n      return 'PHASE: Execution. Use /executor for implementation, /test-engineer for tests. Output: working code with tests.';\n    case 'team-verify':\n      return 'PHASE: Verification. Use /verifier for evidence collection, /quality-reviewer for review. Output: pass/fail with evidence.';\n    case 'team-fix':","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/orchestrator.ts#L120-L156","documentation":"Thrown by getPhaseAgents when the phase argument does not match any known team phase ('team-plan', 'team-exec', 'team-verify', 'team-fix', etc.). The switch is exhaustive over a union type, so hitting the default branch means the runtime value escaped the compile-time union — typically deserialized config from an older/newer version or an any-cast. The `never` assignment is an exhaustiveness check, so this error signals type-system bypass, not ordinary bad input.","triggerScenarios":"Calling getPhaseAgents(phase) with a phase string loaded from persisted team phase state (readTeamPhaseState) written by a different version, or passing a value typed as string/any that was not validated against TeamPhase before the call.","commonSituations":"Upgrading the team orchestrator after a phase was renamed/added, hand-editing phase state files, or reading stale state from disk after a downgrade.","solutions":["Check the persisted phase state file (current_phase) for a value not in the TeamPhase union and reset/delete it","Validate phase with a type guard before calling getPhaseAgents","Re-run with the version of the code that wrote the phase state, or shutdown/resume the team to regenerate state"],"exampleFix":"// before\nconst agents = getPhaseAgents(config.current_phase as TeamPhase);\n// after\nconst PHASES = ['team-plan','team-exec','team-verify','team-fix'] as const;\nfunction isTeamPhase(p: string): p is TeamPhase { return (PHASES as readonly string[]).includes(p); }\nconst phase = config.current_phase;\nconst agents = isTeamPhase(phase) ? getPhaseAgents(phase) : DEFAULT_AGENTS;","handlingStrategy":"type-guard","validationCode":"const PHASES = ['team-plan','team-exec','team-verify','team-fix'] as const;\nconst isTeamPhase = (p: unknown): p is TeamPhase =>\n  typeof p === 'string' && (PHASES as readonly string[]).includes(p);","typeGuard":"function isTeamPhase(p: unknown): p is TeamPhase { return typeof p === 'string' && (PHASES as readonly string[]).includes(p); }","tryCatchPattern":"try { getPhaseAgents(phase); } catch (e) { if (e instanceof Error && e.message.startsWith('Unknown team phase')) { /* reset/reload phase state */ } throw e; }","preventionTips":["Validate deserialized phase state before use","Never cast string to TeamPhase without narrowing","Pin state schema versions across deploys"],"tags":["typescript","exhaustive-switch","state-validation","team-orchestration"],"backgroundTag":"discriminated-union-exhaustiveness-violation","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}