{"record":{"id":"2463241b82b78d99","repo":"nikivdev/code","slug":"path-cannot-be-used-with-no-commit-or-hash","errorCode":null,"errorMessage":"--path cannot be used with --no-commit or --hash","messagePattern":"--path cannot be used with --no-commit or --hash","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commit.rs","lineNumber":9566,"sourceCode":"        return run_pr_feedback(&repo_root, feedback);\n    }\n\n    ensure_git_repo()?;\n    let repo_root = git_root_or_cwd();\n    ensure_commit_setup(&repo_root)?;\n\n    match args.as_slice() {\n        // Convenience: `f pr open` opens the PR for the current branch (or queued commit) without\n        // creating a new commit.\n        [a] if a == \"open\" => return run_pr_open(&repo_root, &opts),\n        // Convenience: `f pr open edit` opens a local markdown file in Zed and syncs PR\n        // title/body on save.\n        [a, b] if a == \"open\" && b == \"edit\" => return run_pr_open_edit(&repo_root, &opts),\n        _ => {}\n    }\n\n    if !opts.paths.is_empty() && (opts.no_commit || opts.hash.is_some()) {\n        bail!(\"--path cannot be used with --no-commit or --hash\");\n    }\n\n    let should_commit = !opts.no_commit && opts.hash.is_none();\n    if should_commit {\n        let queue = resolve_commit_queue_mode(true, false);\n        let review_selection = resolve_review_selection_v2(false, None);\n        let message = if args.is_empty() {\n            None\n        } else {\n            Some(args.join(\" \"))\n        };\n        run_with_check_sync(\n            true,\n            false,\n            review_selection,\n            message.as_deref(),\n            1000,\n            false,","sourceCodeStart":9548,"sourceCodeEnd":9584,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L9548-L9584","documentation":"The `f pr`/commit command rejects mutually exclusive options up front: `--path` (commit only selected paths) combined with `--no-commit` (skip committing) or `--hash` (operate on an existing commit). These modes are contradictory - selecting paths implies creating a commit, while the other two imply not creating one - so the CLI bails before doing any work.","triggerScenarios":"Invoking the command with `--path <p>` together with `--no-commit`, or `--path <p>` together with `--hash <sha>`; typically a scripted or copy-pasted command mixing flags from two different usage modes.","commonSituations":"Reusing a command template and appending `--path` for partial staging; automations that always pass `--hash` and were extended with `--path`; typo/misremembered flag semantics.","solutions":["Remove `--no-commit` if you actually want to commit the selected paths.","Remove `--hash` if you want to commit paths instead of operating on an existing commit.","Drop `--path` if you only meant to skip committing or target an existing hash.","Run the command's help (`f pr --help`) to confirm the intended flag combination."],"exampleFix":"// before\nf pr \"msg\" --path src/foo.rs --no-commit\n// after\nf pr \"msg\" --path src/foo.rs        # or drop --path if using --no-commit/--hash","handlingStrategy":"validation","validationCode":"const KNOWN = new Set([\"--show-full\", \"--todos\", \"--no-todos\"]);\n// validate mode flags before invoking:\nif (args.includes(\"--path\") && (args.includes(\"--no-commit\") || args.includes(\"--hash\"))) {\n  throw new Error(\"--path cannot be combined with --no-commit or --hash\");\n}","typeGuard":null,"tryCatchPattern":"try { await run(args); }\ncatch (e) {\n  if (String(e).includes(\"--path cannot be used\")) fixFlagCombination(args);\n  else throw e;\n}","preventionTips":["Read `--help` before mixing mode flags.","Keep one invocation = one mode (paths-commit, no-commit, or hash).","Validate flag combos in wrapper scripts before invoking the CLI."],"tags":["cli","argument-validation","flags"],"backgroundTag":"incompatible-flags","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}