{"record":{"id":"ebe520d81b582e20","repo":"Yeachan-Heo/oh-my-codex","slug":"missing-worker-launch-policy-for-worker-i","errorCode":null,"errorMessage":"missing worker launch policy for worker-${i}","messagePattern":"missing worker launch policy for worker-(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":3712,"sourceCode":"        worktreeCreated?: boolean;\n      };\n      workerTasks: TeamTask[];\n      workerRole: string;\n      rolePromptContent: string | null;\n      instructionsFilePath: string;\n      inbox: string;\n      trigger: string;\n      triggerIntent: TeamReminderIntent;\n      initialPrompt?: string;\n      workerLaunchArgs: readonly string[];\n      workerCli: TeamWorkerCli;\n      toolContext: ReturnType<typeof resolveWorktreeToolContext>;\n    }>;\n\n    for (let i = 1; i <= workerCount; i++) {\n      const workerLaunchPolicy = workerLaunchPolicyPlan[i - 1];\n      if (!workerLaunchPolicy) {\n        throw new Error(`missing worker launch policy for worker-${i}`);\n      }\n      const workerName = workerLaunchPolicy.workerName;\n      const workerWorkspace = workerWorkspaceByName.get(workerName) ?? { cwd: leaderCwd };\n      const workerTasks = allTasks.filter(t => t.owner === workerName);\n      const runtimeRole = workerLaunchPolicy.workerRole;\n      const rawRolePromptContent = await loadRolePrompt(runtimeRole, join(leaderCwd, '.codex', 'prompts'))\n        ?? await loadRolePrompt(runtimeRole, codexPromptsDir());\n      const workerLaunchArgs = workerLaunchPolicy.workerLaunchArgs;\n      const workerCli = workerLaunchPolicy.workerCli;\n      const resolvedWorkerModel = parseTeamWorkerLaunchArgs([...workerLaunchArgs]).modelOverride ?? undefined;\n      const rolePromptContent = rawRolePromptContent\n        ? composeRoleInstructionsForRole(runtimeRole, rawRolePromptContent, resolvedWorkerModel)\n        : null;\n      const workerWorktreePath = workerWorkspace.worktreePath ?? undefined;\n      const toolContext = resolveWorktreeToolContext({\n        cwd: workerWorkspace.cwd,\n        scope: 'team',\n        repoRoot: workerWorkspace.worktreeRepoRoot ?? leaderCwd,","sourceCodeStart":3694,"sourceCodeEnd":3730,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L3694-L3730","documentation":"Internal invariant error: for each worker index i (1..workerCount), the precomputed workerLaunchPolicyPlan must contain a policy. If the array is shorter than workerCount or has a hole, startup aborts with this message naming the offending worker.","triggerScenarios":"Passing a workerCount larger than the number of entries produced by the launch policy planning phase; a planning step silently skipping/omitting a worker's policy (e.g., name collision or workspace resolution failure earlier in planning).","commonSituations":"Mismatch between requested worker count and planned policies after an error was swallowed during planning; race with concurrent team startups; inconsistent sanitized team name causing some plan entries to be dropped.","solutions":["Retry team startup after fully cleaning the previous/stale team state","Ensure workerCount matches what the planning API expects and no worker names collide","Report as a bug if reproducible with a clean state — the planner and the loop should never disagree","Check for swallowed errors in the planning phase logs preceding this throw"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (workerLaunchPolicyPlan.length !== workerCount || workerLaunchPolicyPlan.some(p => !p)) {\n  throw new Error(`planning produced ${workerLaunchPolicyPlan.length} policies for ${workerCount} workers`);\n}","typeGuard":null,"tryCatchPattern":"try { await startTeam(opts); } catch (e) { if (/^missing worker launch policy/.test(String((e as Error).message))) { /* clean state, retry fresh */ } throw e; }","preventionTips":["Validate planned arrays match workerCount before commit","Never reuse partially-written team state","Avoid concurrent startups of the same team"],"tags":["team-mode","internal-invariant","worker-planning"],"backgroundTag":"internal-invariant-violation","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}