Yeachan-Heo/oh-my-codex · error · Error
Invalid setup scope: ${value}. Expected one of: ${SETUP_SCOP
Error message
Invalid setup scope: ${value}. Expected one of: ${SETUP_SCOPES.join(", ")} What it means
After parsing, the --scope value must be one of the allowed setup scopes (SETUP_SCOPES). Any unrecognized value is rejected at the end of resolveSetupScopeArg.
Source
Thrown at src/cli/index.ts:692
const next = args[index + 1];
if (!next || next.startsWith("-")) {
throw new Error(
`Missing setup scope value after --scope. Expected one of: ${SETUP_SCOPES.join(", ")}`,
);
}
value = next;
index += 1;
continue;
}
if (arg.startsWith("--scope=")) {
value = arg.slice("--scope=".length);
}
}
if (!value) return undefined;
if (SETUP_SCOPES.includes(value as SetupScope)) {
return value as SetupScope;
}
throw new Error(
`Invalid setup scope: ${value}. Expected one of: ${SETUP_SCOPES.join(", ")}`,
);
}
export function resolveSetupTeamModeArg(args: string[]): SetupTeamMode | undefined {
let value: SetupTeamMode | undefined;
const setValue = (next: SetupTeamMode, source: string): void => {
if (value && value !== next) {
throw new Error(
`Conflicting setup Team mode flags: ${source} selects ${next}, but another flag already selected ${value}`,
);
}
value = next;
};
const parseValue = (next: string): SetupTeamMode => {
if (!SETUP_TEAM_MODES.includes(next as SetupTeamMode)) {
throw new Error(
`Invalid setup Team mode: ${next}. Expected one of: enabled, disabled`,View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Check help output for the exact scope list (SETUP_SCOPES)
- Use the exact lowercase scope name, e.g. project/user as supported
Example fix
# before omx setup --scope local # after omx setup --scope project
Defensive patterns
Strategy: type-guard
Validate before calling
if (!SETUP_SCOPES.includes(scope)) throw new Error(`invalid scope: ${scope}`); Type guard
const isSetupScope = (v: string): v is SetupScope => SETUP_SCOPES.includes(v as SetupScope);
Prevention
- Print supported scopes in CLI help and read it after upgrades
When it happens
Trigger: `--scope repo`, `--scope Global` — any value not in SETUP_SCOPES (note this check happens after the loop, so the value isn't validated inline).
Common situations: Version drift where scope names changed; guessing scope names like `local` vs `project`.
Related errors
- Invalid setup install mode: ${next}. Expected one of: legacy
- Invalid setup MCP mode: ${next}. Expected one of: none, comp
- Invalid setup Team mode: ${next}. Expected one of: enabled,
- Expected --scope user|project
- Missing setup scope value after --scope. Expected one of: ${
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/3d6f73cccefbbe78.
Report an issue: GitHub.