Yeachan-Heo/oh-my-codex · error · Error
Invalid setup install mode: ${next}. Expected one of: legacy
Error message
Invalid setup install mode: ${next}. Expected one of: legacy, plugin What it means
The value after --install-mode must be exactly `legacy` or `plugin`; anything else is rejected. This is a typo/validation guard for the install mode enum.
Source
Thrown at src/cli/index.ts:598
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === "--plugin") {
setValue("plugin", arg);
continue;
}
if (arg === "--legacy") {
setValue("legacy", arg);
continue;
}
if (arg === "--install-mode") {
const next = args[index + 1];
if (!next || next.startsWith("-")) {
throw new Error(
`Missing setup install mode value after --install-mode. Expected one of: legacy, plugin`,
);
}
if (next !== "legacy" && next !== "plugin") {
throw new Error(
`Invalid setup install mode: ${next}. Expected one of: legacy, plugin`,
);
}
setValue(next, arg);
index += 1;
continue;
}
if (arg.startsWith("--install-mode=")) {
const next = arg.slice("--install-mode=".length);
if (next !== "legacy" && next !== "plugin") {
throw new Error(
`Invalid setup install mode: ${next}. Expected one of: legacy, plugin`,
);
}
setValue(next, "--install-mode");
}
}
View on GitHub (pinned to 3ad79a8a6f)
Solutions
- Correct the value to `legacy` or `plugin` (lowercase)
- Check the CLI help for supported install modes in your version
Example fix
# before omx setup --install-mode Plugins # after omx setup --install-mode plugin
Defensive patterns
Strategy: validation
Validate before calling
const INSTALL_MODES = ['legacy', 'plugin'];
const v = args[args.indexOf('--install-mode') + 1];
if (!INSTALL_MODES.includes(v)) throw new Error(`invalid mode: ${v}`); Type guard
const isSetupInstallMode = (v: string): v is 'legacy' | 'plugin' => ['legacy','plugin'].includes(v);
Prevention
- Lowercase mode names
- Check CLI help for the enum
When it happens
Trigger: `--install-mode plugins`, `--install-mode Legacy` (wrong case/typo), or any other string.
Common situations: Misspelling, wrong casing, or assuming a mode name from a different version of the tool.
Related errors
- Invalid setup MCP mode: ${next}. Expected one of: none, comp
- Invalid setup scope: ${value}. Expected one of: ${SETUP_SCOP
- Invalid setup Team mode: ${next}. Expected one of: enabled,
- Conflicting setup AGENTS merge policy flags: ${source} confl
- Setup AGENTS merge policy flags do not accept values: ${arg}
AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27).
Data as JSON: /api/errors/8ee2aa7c4296939a.
Report an issue: GitHub.