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

missing worker launch plan for worker-${i}

Error message

missing worker launch plan for worker-${i}

What it means

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.

Source

Thrown at src/team/runtime.ts:3938

        }
      }

      for (const [index, paneId] of createdSession.workerPaneIds.entries()) {
        startupTiming.mark('split_returned', { worker: `worker-${index + 1}`, pane_id: paneId });
      }
    } else {
      config.tmux_session = `prompt-${sanitized}`;
      config.leader_pane_id = null;
      config.hud_pane_id = null;
      config.leader_pane_pid = null;
      config.hud_pane_pid = null;
      config.resize_hook_name = null;
      config.resize_hook_target = null;
      for (let i = 1; i <= workerCount; i++) {
        const startup = workerStartups[i - 1];
        const workerLaunchPolicy = workerLaunchPolicyPlan[i - 1];
        if (!startup || !workerLaunchPolicy) {
          throw new Error(`missing worker launch plan for worker-${i}`);
        }
        const child = spawnPromptWorker(
          sanitized,
          workerLaunchPolicy.workerName,
          i,
          startup.cwd,
          startup.launchArgs,
          startup.env,
          startup.workerCli,
          startup.initialPrompt,
          startup.workerRole,
        );
        if (config.workers[i - 1]) {
          config.workers[i - 1].pid = child.pid;
        }
      }
    }

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Clean stale team state and retry a fresh startup
  2. Verify workerCount is consistent across all options passed to the team API
  3. Check earlier startup logs for a worker whose startup record was skipped
  4. Report as a bug if reproducible on clean state
Defensive patterns

Strategy: validation

Validate before calling

if (workerStartups.length !== workerCount || workerLaunchPolicyPlan.length !== workerCount) {
  throw new Error('startup/planning arrays do not match workerCount; aborting before spawn');
}

Try / catch

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

Prevention

When it happens

Trigger: 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.

Common situations: Partial failures in earlier startup phases leaving arrays shorter than workerCount; bugs in planning; mismatched worker counts after resizing operations.

Related errors


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