{"record":{"id":"5ec43324e6073e22","repo":"Yeachan-Heo/oh-my-codex","slug":"missing-worker-launch-plan-for-worker-i","errorCode":null,"errorMessage":"missing worker launch plan for worker-${i}","messagePattern":"missing worker launch plan for worker-(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":3938,"sourceCode":"        }\n      }\n\n      for (const [index, paneId] of createdSession.workerPaneIds.entries()) {\n        startupTiming.mark('split_returned', { worker: `worker-${index + 1}`, pane_id: paneId });\n      }\n    } else {\n      config.tmux_session = `prompt-${sanitized}`;\n      config.leader_pane_id = null;\n      config.hud_pane_id = null;\n      config.leader_pane_pid = null;\n      config.hud_pane_pid = null;\n      config.resize_hook_name = null;\n      config.resize_hook_target = null;\n      for (let i = 1; i <= workerCount; i++) {\n        const startup = workerStartups[i - 1];\n        const workerLaunchPolicy = workerLaunchPolicyPlan[i - 1];\n        if (!startup || !workerLaunchPolicy) {\n          throw new Error(`missing worker launch plan for worker-${i}`);\n        }\n        const child = spawnPromptWorker(\n          sanitized,\n          workerLaunchPolicy.workerName,\n          i,\n          startup.cwd,\n          startup.launchArgs,\n          startup.env,\n          startup.workerCli,\n          startup.initialPrompt,\n          startup.workerRole,\n        );\n        if (config.workers[i - 1]) {\n          config.workers[i - 1].pid = child.pid;\n        }\n      }\n    }\n","sourceCodeStart":3920,"sourceCodeEnd":3956,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L3920-L3956","documentation":"Internal invariant: before spawning workers, both workerStartups[i-1] and workerLaunchPolicyPlan[i-1] must exist for every i in 1..workerCount. A missing startup record or policy aborts the spawn loop with this error.","triggerScenarios":"workerCount exceeding the length of the workerStartups array or the launch policy plan; a startup step failing to record its result for a worker (e.g., pane spawn skipped on error) while the loop continues.","commonSituations":"Partial failures in earlier startup phases leaving arrays shorter than workerCount; bugs in planning; mismatched worker counts after resizing operations.","solutions":["Clean stale team state and retry a fresh startup","Verify workerCount is consistent across all options passed to the team API","Check earlier startup logs for a worker whose startup record was skipped","Report as a bug if reproducible on clean state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (workerStartups.length !== workerCount || workerLaunchPolicyPlan.length !== workerCount) {\n  throw new Error('startup/planning arrays do not match workerCount; aborting before spawn');\n}","typeGuard":null,"tryCatchPattern":"try { await startTeam(opts); } catch (e) { if (/^missing worker launch plan/.test(String((e as Error).message))) { await cleanupTeamState(leaderCwd); return startTeam(opts); } throw e; }","preventionTips":["Keep workerCount consistent across all team API options","Clean stale state before starting","Treat as a bug report candidate if reproducible"],"tags":["team-mode","internal-invariant","worker-spawn"],"backgroundTag":"internal-invariant-violation","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}