{"record":{"id":"c8b516b029852aab","repo":"Yeachan-Heo/oh-my-codex","slug":"worktree-not-planned-workername","errorCode":null,"errorMessage":"worktree_not_planned:${workerName}","messagePattern":"worktree_not_planned:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/scaling.ts","lineNumber":1119,"sourceCode":"        `worker-${workerIndex}-startup.sh`,\n      );\n      let workerWorkspace: EnsureWorktreeResult | null = null;\n      let workerCwd = leaderCwd;\n      let cmd: string;\n      let rawRolePromptContent: string | null = null;\n      try {\n        preparedWorkerDirectoryOwner.set(workerDirPath, workerName);\n        await mkdir(workerDirPath, { recursive: true });\n\n        if (effectiveWorktreeMode.enabled) {\n          const worktreePlan = planWorktreeTarget({\n            cwd: leaderCwd,\n            scope: 'team',\n            mode: effectiveWorktreeMode,\n            teamName: sanitized,\n            workerName,\n          });\n          if (!worktreePlan.enabled) throw new Error(`worktree_not_planned:${workerName}`);\n          const worktreePathExistedBeforeEnsure = existsSync(worktreePlan.worktreePath);\n          const branchExistedBeforeEnsure = worktreePlan.branchName\n            ? spawnSync('git', ['show-ref', '--verify', '--quiet', `refs/heads/${worktreePlan.branchName}`], {\n                cwd: worktreePlan.repoRoot,\n                encoding: 'utf-8',\n                windowsHide: true,\n              }).status === 0\n            : false;\n          try {\n            const ensuredWorkspace = ensureWorktree(worktreePlan);\n            throwIfScaleUpFailureInjected(env, 'worktree-ensure-post-create');\n            if (!ensuredWorkspace.enabled) throw new Error(`worktree_not_provisioned:${workerName}`);\n            workerWorkspace = ensuredWorkspace;\n          } catch (error) {\n            const recoveredWorkspace = recoverCreatedWorktreeAfterEnsureFailure(\n              worktreePlan,\n              worktreePathExistedBeforeEnsure,\n              branchExistedBeforeEnsure,","sourceCodeStart":1101,"sourceCodeEnd":1137,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/scaling.ts#L1101-L1137","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run scaleUp from the git repository root (leader cwd must be inside a valid git repo with at least one commit)","Verify 'git status' works in the leader cwd and the repo has an initial commit","Check the effective worktree mode setting (env/config) matches an intended mode for this repo"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { spawnSync } from 'node:child_process';\nfunction gitRepoUsable(cwd: string): boolean {\n  return spawnSync('git', ['rev-parse', '--verify', 'HEAD'], { cwd }).status === 0;\n}","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if ((e as Error).message.startsWith('worktree_not_planned')) {\n    throw new Error('scaleUp requires a git repo with at least one commit');\n  }\n  throw e;\n}","preventionTips":["Always create teams from inside an initialized git repo with a commit","Verify git is installed and on PATH in the environment running scaleUp"],"tags":["team","scaling","worktree","git"],"backgroundTag":"worktree-setup-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}