Yeachan-Heo/oh-my-codex · error · Error

Invalid setup MCP mode: ${next}. Expected one of: none, comp

Error message

Invalid setup MCP mode: ${next}. Expected one of: none, compat

What it means

The MCP mode value must be one of the allowed enum values (`none` or `compat`). Any other string (from --mcp <value> or --mcp=<value>) is rejected.

Source

Thrown at src/cli/index.ts:633

  }

  return value;
}


export function resolveSetupMcpModeArg(args: string[]): SetupMcpMode | undefined {
  let value: SetupMcpMode | undefined;
  const setValue = (next: SetupMcpMode, source: string): void => {
    if (value && value !== next) {
      throw new Error(
        `Conflicting setup MCP mode flags: ${source} selects ${next}, but another flag already selected ${value}`,
      );
    }
    value = next;
  };
  const parseValue = (next: string): SetupMcpMode => {
    if (!SETUP_MCP_MODES.includes(next as SetupMcpMode)) {
      throw new Error(
        `Invalid setup MCP mode: ${next}. Expected one of: none, compat`,
      );
    }
    return next as SetupMcpMode;
  };

  for (let index = 0; index < args.length; index += 1) {
    const arg = args[index];
    if (arg === "--no-mcp") {
      setValue("none", arg);
      continue;
    }
    if (arg === "--with-mcp") {
      setValue("compat", arg);
      continue;
    }
    if (arg === "--mcp") {
      const next = args[index + 1];

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Use `none` or `compat` exactly
  2. Run help to list current SETUP_MCP_MODES

Example fix

# before
omx setup --mcp default
# after
omx setup --mcp compat
Defensive patterns

Strategy: type-guard

Validate before calling

const MCP_MODES = ['none', 'compat'];
if (!MCP_MODES.includes(value)) throw new Error('invalid MCP mode');

Type guard

const isSetupMcpMode = (v: string): v is 'none' | 'compat' => v === 'none' || v === 'compat';

Prevention

When it happens

Trigger: `--mcp default`, `--mcp=None` (wrong case), or an unsupported mode name.

Common situations: Expecting modes removed/renamed across versions; guessing mode names.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/51c27757e248baf2. Report an issue: GitHub.