{"record":{"id":"f04a0f404c73e361","repo":"Yeachan-Heo/oh-my-codex","slug":"conflicting-setup-mcp-mode-flags-source-select","errorCode":null,"errorMessage":"Conflicting setup MCP mode flags: ${source} selects ${next}, but another flag already selected ${value}","messagePattern":"Conflicting setup MCP mode flags: (.+?) selects (.+?), but another flag already selected (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":625,"sourceCode":"      const next = arg.slice(\"--install-mode=\".length);\n      if (next !== \"legacy\" && next !== \"plugin\") {\n        throw new Error(\n          `Invalid setup install mode: ${next}. Expected one of: legacy, plugin`,\n        );\n      }\n      setValue(next, \"--install-mode\");\n    }\n  }\n\n  return value;\n}\n\n\nexport function resolveSetupMcpModeArg(args: string[]): SetupMcpMode | undefined {\n  let value: SetupMcpMode | undefined;\n  const setValue = (next: SetupMcpMode, source: string): void => {\n    if (value && value !== next) {\n      throw new Error(\n        `Conflicting setup MCP mode flags: ${source} selects ${next}, but another flag already selected ${value}`,\n      );\n    }\n    value = next;\n  };\n  const parseValue = (next: string): SetupMcpMode => {\n    if (!SETUP_MCP_MODES.includes(next as SetupMcpMode)) {\n      throw new Error(\n        `Invalid setup MCP mode: ${next}. Expected one of: none, compat`,\n      );\n    }\n    return next as SetupMcpMode;\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n    if (arg === \"--no-mcp\") {\n      setValue(\"none\", arg);","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L607-L643","documentation":"MCP mode flags (--mcp, --no-mcp, --mcp=<mode>) are mutually exclusive; selecting a second, different mode after one is already set throws this error.","triggerScenarios":"`omx setup --mcp none --mcp compat` or `--no-mcp --mcp compat`.","commonSituations":"Composed setup scripts layering defaults over user args; alias commands that inject extra MCP flags.","solutions":["Provide exactly one MCP mode selection","Use --mcp=<mode> once instead of mixing shorthand flags"],"exampleFix":"# before\nomx setup --no-mcp --mcp compat\n# after\nomx setup --mcp=compat","handlingStrategy":"validation","validationCode":"const mcpFlags = args.filter(a => a === '--mcp' || a === '--no-mcp' || a.startsWith('--mcp='));\nif (mcpFlags.length > 1) throw new Error('conflicting MCP flags');","typeGuard":"const isSetupMcpMode = (v: string): v is SetupMcpMode => ['none','compat'].includes(v);","tryCatchPattern":"catch (e) { if (/Conflicting setup MCP mode/.test(e.message)) /* keep single --mcp=mode */ }","preventionTips":["Specify MCP mode exactly once"],"tags":["cli","conflicting-flags","mcp","setup"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}