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

worktree_not_planned:${workerName}

Error message

worktree_not_planned:${workerName}

What it means

Thrown when worktree planning returns disabled (worktreePlan.enabled is false) even though the effective worktree mode requested a worktree for the new worker. The scale-up refuses to provision a worker without a planned worktree path.

Source

Thrown at src/team/scaling.ts:1119

        `worker-${workerIndex}-startup.sh`,
      );
      let workerWorkspace: EnsureWorktreeResult | null = null;
      let workerCwd = leaderCwd;
      let cmd: string;
      let rawRolePromptContent: string | null = null;
      try {
        preparedWorkerDirectoryOwner.set(workerDirPath, workerName);
        await mkdir(workerDirPath, { recursive: true });

        if (effectiveWorktreeMode.enabled) {
          const worktreePlan = planWorktreeTarget({
            cwd: leaderCwd,
            scope: 'team',
            mode: effectiveWorktreeMode,
            teamName: sanitized,
            workerName,
          });
          if (!worktreePlan.enabled) throw new Error(`worktree_not_planned:${workerName}`);
          const worktreePathExistedBeforeEnsure = existsSync(worktreePlan.worktreePath);
          const branchExistedBeforeEnsure = worktreePlan.branchName
            ? spawnSync('git', ['show-ref', '--verify', '--quiet', `refs/heads/${worktreePlan.branchName}`], {
                cwd: worktreePlan.repoRoot,
                encoding: 'utf-8',
                windowsHide: true,
              }).status === 0
            : false;
          try {
            const ensuredWorkspace = ensureWorktree(worktreePlan);
            throwIfScaleUpFailureInjected(env, 'worktree-ensure-post-create');
            if (!ensuredWorkspace.enabled) throw new Error(`worktree_not_provisioned:${workerName}`);
            workerWorkspace = ensuredWorkspace;
          } catch (error) {
            const recoveredWorkspace = recoverCreatedWorktreeAfterEnsureFailure(
              worktreePlan,
              worktreePathExistedBeforeEnsure,
              branchExistedBeforeEnsure,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Run scaleUp from the git repository root (leader cwd must be inside a valid git repo with at least one commit)
  2. Verify 'git status' works in the leader cwd and the repo has an initial commit
  3. Check the effective worktree mode setting (env/config) matches an intended mode for this repo
Defensive patterns

Strategy: validation

Validate before calling

import { spawnSync } from 'node:child_process';
function gitRepoUsable(cwd: string): boolean {
  return spawnSync('git', ['rev-parse', '--verify', 'HEAD'], { cwd }).status === 0;
}

Try / catch

catch (e) {
  if ((e as Error).message.startsWith('worktree_not_planned')) {
    throw new Error('scaleUp requires a git repo with at least one commit');
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling scaleUp with a worktree mode enabled while planWorktree returns enabled:false, e.g. the target repo is not a git repository, has no commits, or is in a detached/invalid state.

Common situations: Running scale-up in a directory that is not a git repo; empty repository with no HEAD commit; misconfigured worktree mode via env/config; unsupported platform git.

Related errors


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