{"record":{"id":"23a52253ec830d58","repo":"Yeachan-Heo/oh-my-codex","slug":"scale-up-missing-team-worktree-contract-config-n","errorCode":null,"errorMessage":"scale_up_missing_team_worktree_contract:${config.name}","messagePattern":"scale_up_missing_team_worktree_contract:(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/scaling.ts","lineNumber":498,"sourceCode":"    case 'valid':\n      return {\n        ok: true,\n        approvedContextSection: buildApprovedTeamHandoffSection(approvedExecutionState.approvedHint),\n      };\n    default:\n      return assertUnreachableApprovedExecutionState(approvedExecutionState);\n  }\n}\n\nfunction resolveLegacyScaledTeamWorktreeMode(config: Pick<TeamConfig, 'name' | 'workspace_mode' | 'worktree_mode' | 'workers'>): WorktreeMode {\n  if (config.worktree_mode) return config.worktree_mode;\n  if (config.workspace_mode !== 'worktree') return { enabled: false };\n\n  const workersWithMetadata = config.workers.filter((worker) =>\n    worker.worktree_path || worker.worktree_branch || typeof worker.worktree_detached === 'boolean',\n  );\n  if (workersWithMetadata.length === 0) {\n    throw new Error(`scale_up_missing_team_worktree_contract:${config.name}`);\n  }\n\n  if (workersWithMetadata.some((worker) => worker.worktree_detached === true)) {\n    return { enabled: true, detached: true, name: null };\n  }\n\n  const branchPrefixes = new Set(\n    workersWithMetadata\n      .map((worker) => worker.worktree_branch?.trim())\n      .filter((branch): branch is string => Boolean(branch))\n      .map((branch) => {\n        const match = /^(.*)\\/worker-\\d+$/.exec(branch);\n        return match?.[1]?.trim() || '';\n      })\n      .filter(Boolean),\n  );\n\n  if (branchPrefixes.size === 1) {","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/scaling.ts#L480-L516","documentation":"Thrown while resolving the legacy worktree mode for scale-up: the team is in worktree workspace_mode but no worker carries worktree metadata (worktree_path, worktree_branch, or worktree_detached), so the branch naming contract cannot be inferred.","triggerScenarios":"Calling scaleUp on a worktree-mode team whose config.workers all lack worktree metadata — e.g. a hand-written or migrated config missing the worktree contract.","commonSituations":"Configs authored before the worktree contract existed, or manually constructed TeamConfig objects in tests/tools.","solutions":["Ensure existing workers have worktree_path/worktree_branch metadata before scaling","Recreate the team so the config records the worktree contract","If migrating, backfill worktree metadata for each worker in the config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const hasContract = cfg.workers.some(w => w.worktree_path || w.worktree_branch || typeof w.worktree_detached === 'boolean'); if (!hasContract) throw new Error('team lacks worktree contract — recreate team');","typeGuard":"const hasWorktreeContract = (cfg: TeamConfig) => cfg.workers.some(w => w.worktree_path || w.worktree_branch || typeof w.worktree_detached === 'boolean');","tryCatchPattern":null,"preventionTips":["Create teams through the official API so worktree metadata is recorded","Don't hand-author worktree-mode team configs"],"tags":["scaling","worktree","config-contract"],"backgroundTag":"schema-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}