{"record":{"id":"a9eb702aeae36d18","repo":"Yeachan-Heo/oh-my-codex","slug":"conflicting-setup-install-mode-flags-source-se","errorCode":null,"errorMessage":"Conflicting setup install mode flags: ${source} selects ${next}, but another flag already selected ${value}","messagePattern":"Conflicting setup install mode flags: (.+?) selects (.+?), but another flag already selected (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":573,"sourceCode":"      arg.startsWith(\"--no-merge-agents=\") ||\n      arg.startsWith(\"--clear-merge-agents-policy=\")\n    ) {\n      throw new Error(`Setup AGENTS merge policy flags do not accept values: ${arg}`);\n    }\n  }\n  return policy;\n}\n\nexport function resolveSetupMergeAgentsArg(args: string[]): boolean | undefined {\n  const policy = resolveSetupAgentsMergePolicyArg(args);\n  return policy?.kind === \"set\" ? policy.value : undefined;\n}\n\nexport function resolveSetupInstallModeArg(args: string[]): SetupInstallMode | undefined {\n  let value: SetupInstallMode | undefined;\n  const setValue = (next: SetupInstallMode, source: string): void => {\n    if (value && value !== next) {\n      throw new Error(\n        `Conflicting setup install mode flags: ${source} selects ${next}, but another flag already selected ${value}`,\n      );\n    }\n    value = next;\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n    if (arg === \"--plugin\") {\n      setValue(\"plugin\", arg);\n      continue;\n    }\n    if (arg === \"--legacy\") {\n      setValue(\"legacy\", arg);\n      continue;\n    }\n    if (arg === \"--install-mode\") {\n      const next = args[index + 1];","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L555-L591","documentation":"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`.","triggerScenarios":"Passing two or more install-mode flags that resolve to different modes, e.g. `omx setup --legacy --plugin` or `--install-mode legacy --plugin`.","commonSituations":"Copy-pasted command lines accumulating flags; CI scripts appending a default mode flag after a user-supplied one.","solutions":["Inspect the full command and keep only one install mode flag","If using --install-mode <value>, drop the shorthand flags --legacy/--plugin"],"exampleFix":"# before\nomx setup --legacy --plugin\n# after\nomx setup --plugin","handlingStrategy":"validation","validationCode":"const modeFlags = args.filter(a => ['--legacy','--plugin'].includes(a) || a.startsWith('--install-mode'));\nif (new Set(modeFlags).size > 1) throw new Error('conflict');","typeGuard":"const isSetupInstallMode = (v: string): v is SetupInstallMode => v === 'legacy' || v === 'plugin';","tryCatchPattern":"catch (e) { if (/Conflicting setup install mode/.test(e.message)) /* strip duplicate flag and retry */ }","preventionTips":["Set mode once via --install-mode=<value>","Avoid mixing shorthand and long forms"],"tags":["cli","argument-parsing","conflicting-flags","setup"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}