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

Conflicting setup install mode flags: ${source} selects ${ne

Error message

Conflicting setup install mode flags: ${source} selects ${next}, but another flag already selected ${value}

What it means

Setup install mode flags are mutually exclusive: once one flag (e.g. --legacy or --plugin) selects a mode, a later flag selecting a different mode is rejected. This protects against contradictory CLI input like `--legacy --plugin`.

Source

Thrown at src/cli/index.ts:573

      arg.startsWith("--no-merge-agents=") ||
      arg.startsWith("--clear-merge-agents-policy=")
    ) {
      throw new Error(`Setup AGENTS merge policy flags do not accept values: ${arg}`);
    }
  }
  return policy;
}

export function resolveSetupMergeAgentsArg(args: string[]): boolean | undefined {
  const policy = resolveSetupAgentsMergePolicyArg(args);
  return policy?.kind === "set" ? policy.value : undefined;
}

export function resolveSetupInstallModeArg(args: string[]): SetupInstallMode | undefined {
  let value: SetupInstallMode | undefined;
  const setValue = (next: SetupInstallMode, source: string): void => {
    if (value && value !== next) {
      throw new Error(
        `Conflicting setup install mode flags: ${source} selects ${next}, but another flag already selected ${value}`,
      );
    }
    value = next;
  };

  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];

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Inspect the full command and keep only one install mode flag
  2. If using --install-mode <value>, drop the shorthand flags --legacy/--plugin

Example fix

# before
omx setup --legacy --plugin
# after
omx setup --plugin
Defensive patterns

Strategy: validation

Validate before calling

const modeFlags = args.filter(a => ['--legacy','--plugin'].includes(a) || a.startsWith('--install-mode'));
if (new Set(modeFlags).size > 1) throw new Error('conflict');

Type guard

const isSetupInstallMode = (v: string): v is SetupInstallMode => v === 'legacy' || v === 'plugin';

Try / catch

catch (e) { if (/Conflicting setup install mode/.test(e.message)) /* strip duplicate flag and retry */ }

Prevention

When it happens

Trigger: Passing two or more install-mode flags that resolve to different modes, e.g. `omx setup --legacy --plugin` or `--install-mode legacy --plugin`.

Common situations: Copy-pasted command lines accumulating flags; CI scripts appending a default mode flag after a user-supplied one.

Related errors


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