{"record":{"id":"2a3c1ab431ff19cf","repo":"rtk-ai/rtk","slug":"codex-cannot-be-combined-with-claude-md","errorCode":null,"errorMessage":"--codex cannot be combined with --claude-md","messagePattern":"--codex cannot be combined with --claude-md","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":401,"sourceCode":"    install_claude: bool,\n    install_opencode: bool,\n    install_cursor: bool,\n    install_windsurf: bool,\n    install_cline: bool,\n    claude_md: bool,\n    hook_only: bool,\n    codex: bool,\n    patch_mode: PatchMode,\n    ctx: InitContext,\n) -> Result<()> {\n    let InitContext { dry_run, .. } = ctx;\n    // Validation: Codex mode conflicts\n    if codex {\n        if install_opencode {\n            anyhow::bail!(\"--codex cannot be combined with --opencode\");\n        }\n        if claude_md {\n            anyhow::bail!(\"--codex cannot be combined with --claude-md\");\n        }\n        if hook_only {\n            anyhow::bail!(\"--codex cannot be combined with --hook-only\");\n        }\n        if matches!(patch_mode, PatchMode::Auto) {\n            anyhow::bail!(\"--codex cannot be combined with --auto-patch\");\n        }\n        if matches!(patch_mode, PatchMode::Skip) {\n            anyhow::bail!(\"--codex cannot be combined with --no-patch\");\n        }\n        run_codex_mode(global, ctx)?;\n    } else {\n        // Validation: Global-only features\n        if install_opencode && !global {\n            anyhow::bail!(\"OpenCode plugin is global-only. Use: rtk init -g --opencode\");\n        }\n\n        if install_cursor && !global {","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/init.rs#L383-L419","documentation":"rtk's `rtk init` command refuses to initialize Codex mode together with the --claude-md flag. Codex mode configures the Codex agent exclusively, so Claude-specific setup (installing a CLAUDE.md integration) is meaningless alongside it. The check lives at the top of HooksInit::run before any files are written, so it fails fast with no side effects.","triggerScenarios":"Running `rtk init --codex --claude-md` (with or without -g). The bail fires whenever the parsed `codex` flag is true and `claude_md` is true, immediately after the --opencode conflict check.","commonSituations":"A developer wants hooks for both Codex and Claude and passes both flags in one command, or copies an init command from docs for Claude and appends --codex to also target Codex. Scripts templating multiple agent flags into a single init call.","solutions":["Run two separate init commands: `rtk init --codex` and `rtk init --claude-md`","Drop --claude-md if only Codex integration is wanted: `rtk init --codex`","Drop --codex if only the Claude integration is wanted"],"exampleFix":"// before\nrtk init --codex --claude-md\n// after\nrtk init --codex\nrtk init --claude-md","handlingStrategy":"validation","validationCode":"const codex = args.includes(\"--codex\");\nconst claudeMd = args.includes(\"--claude-md\");\nif (codex && claudeMd) throw new Error(\"--codex cannot be combined with --claude-md\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one agent integration per rtk init invocation","Build init commands from an agent variable, not by concatenating multiple agent flags","Check `rtk init --help` for documented flag conflicts before scripting"],"tags":["cli","validation","codex","conflicting-flags"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}