{"record":{"id":"ed67989cca36bd37","repo":"rtk-ai/rtk","slug":"codex-cannot-be-combined-with-no-patch","errorCode":null,"errorMessage":"--codex cannot be combined with --no-patch","messagePattern":"--codex cannot be combined with --no-patch","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/init.rs","lineNumber":410,"sourceCode":"    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 {\n            anyhow::bail!(\"Cursor hooks are global-only. Use: rtk init -g --agent cursor\");\n        }\n\n        if install_windsurf && !global {\n            anyhow::bail!(\"Windsurf support is global-only. Use: rtk init -g --agent windsurf\");\n        }\n\n        if install_windsurf {\n            run_windsurf_mode(ctx)?;","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/hooks/init.rs#L392-L428","documentation":"rtk's `rtk init` rejects --codex together with --no-patch (PatchMode::Skip). As with --auto-patch, patch-mode selection is not configurable in Codex mode, so combining the agent flag with a skip-patch request is contradictory and bails out before any setup work.","triggerScenarios":"Running `rtk init --codex --no-patch`. Fires whenever `codex` is true and `patch_mode` matches PatchMode::Skip, as the last check in the codex validation block before run_codex_mode.","commonSituations":"A user switching from `rtk init --no-patch` to Codex integration keeps the old flag in place. CI scripts parameterized with PATCH_FLAGS='--no-patch' that also hardcode --codex.","solutions":["Run `rtk init --codex` without --no-patch (Codex mode controls patch behavior itself)","If skipping patches is essential, omit --codex: `rtk init --no-patch`"],"exampleFix":"// before\nrtk init --codex --no-patch\n// after\nrtk init --codex","handlingStrategy":"validation","validationCode":"const codex = args.includes(\"--codex\");\nconst patchFlags = [\"--auto-patch\", \"--no-patch\"];\nif (codex && patchFlags.some(f => args.includes(f))) throw new Error(\"patch-mode flags are not allowed with --codex\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine --codex with --no-patch; if you need no-patch behavior, use the default init path","Parameterize CI scripts so agent choice and patch-mode flags are mutually exclusive variables"],"tags":["cli","validation","codex","patch-mode","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"}