{"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":283,"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":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/hooks/init.rs#L265-L301","documentation":"`rtk init --codex` is an exclusive mode; the validation block at src/hooks/init.rs:283 rejects --claude-md alongside it because --codex does not write a CLAUDE.md (it installs Codex config instead), so the two request incompatible outputs.","triggerScenarios":"`rtk init --codex --claude-md`. Both flags parse, but codex mode would never write CLAUDE.md, so init fails fast rather than half-perform.","commonSituations":"Users wanting rules files for BOTH Codex and Claude concatenating flags from docs; setup scripts evolving over time by appending options; --codex mistaken for 'also install for Codex'.","solutions":["Run `rtk init --codex` alone for the Codex setup","Get the CLAUDE.md from a separate default run: `rtk init` (or `rtk init --claude-md` without --codex)","Review `rtk init --help` for which flags compose with which modes"],"exampleFix":"# before\nrtk init --codex --claude-md\n# --codex cannot be combined with --claude-md\n\n# after: split into two runs\nrtk init --codex\nrtk init --claude-md","handlingStrategy":"validation","validationCode":"bash:\nif [[ \"$*\" == *--codex* && \"$*\" == *--claude-md* ]]; then\n  echo \"--codex and --claude-md are mutually exclusive; run them separately\" >&2\n  exit 2\nfi\nrtk init \"$@\"","typeGuard":"rust:\nfn codex_claude_md_conflict(codex: bool, claude_md: bool) -> bool {\n    codex && claude_md\n}","tryCatchPattern":"rust:\n// prefer clap-level rejection:\n#[arg(long, conflicts_with = \"claude_md\")] codex: bool,\n// runtime:\nif let Err(e) = init::run(...) {\n    if e.to_string().contains(\"--codex cannot be combined with --claude-md\") { exit(2); }\n}","preventionTips":["Codex mode never writes CLAUDE.md — get it from a separate default `rtk init` run","Don't concatenate init lines from different docs into one command","One mode's flags per invocation keeps init predictable"],"tags":["init","cli","usage","flag-conflict","codex","claude-md"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}