Yeachan-Heo/oh-my-codex · error · Error
scale_up_missing_team_worktree_contract:${config.name}
Error message
scale_up_missing_team_worktree_contract:${config.name} What it means
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.
Source
Thrown at src/team/scaling.ts:498
case 'valid':
return {
ok: true,
approvedContextSection: buildApprovedTeamHandoffSection(approvedExecutionState.approvedHint),
};
default:
return assertUnreachableApprovedExecutionState(approvedExecutionState);
}
}
function resolveLegacyScaledTeamWorktreeMode(config: Pick<TeamConfig, 'name' | 'workspace_mode' | 'worktree_mode' | 'workers'>): WorktreeMode {
if (config.worktree_mode) return config.worktree_mode;
if (config.workspace_mode !== 'worktree') return { enabled: false };
const workersWithMetadata = config.workers.filter((worker) =>
worker.worktree_path || worker.worktree_branch || typeof worker.worktree_detached === 'boolean',
);
if (workersWithMetadata.length === 0) {
throw new Error(`scale_up_missing_team_worktree_contract:${config.name}`);
}
if (workersWithMetadata.some((worker) => worker.worktree_detached === true)) {
return { enabled: true, detached: true, name: null };
}
const branchPrefixes = new Set(
workersWithMetadata
.map((worker) => worker.worktree_branch?.trim())
.filter((branch): branch is string => Boolean(branch))
.map((branch) => {
const match = /^(.*)\/worker-\d+$/.exec(branch);
return match?.[1]?.trim() || '';
})
.filter(Boolean),
);
if (branchPrefixes.size === 1) {View on GitHub (pinned to 3ad79a8a6f)
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
Defensive patterns
Strategy: validation
Validate before calling
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'); Type guard
const hasWorktreeContract = (cfg: TeamConfig) => cfg.workers.some(w => w.worktree_path || w.worktree_branch || typeof w.worktree_detached === 'boolean');
Prevention
- Create teams through the official API so worktree metadata is recorded
- Don't hand-author worktree-mode team configs
When it happens
Trigger: 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.
Common situations: Configs authored before the worktree contract existed, or manually constructed TeamConfig objects in tests/tools.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- worktree_not_planned:${workerName}
- worktree_not_provisioned:${workerName}
- (result.stderr || '').trim() || `git ${args.join(' ')} faile
- (result.stderr || '').trim() || `git status failed for ${wor
- autoresearch_reset_requires_clean_worktree
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/23a52253ec830d58.
Report an issue: GitHub.