{"record":{"id":"aa7ab53788c951b5","repo":"gitbutlerapp/gitbutler","slug":"ai-cannot-be-combined-with-a-resolve-subcommand","errorCode":null,"errorMessage":"--ai cannot be combined with a resolve subcommand. For one conflict, use `but resolve apply <path>[:<N>] --ai` instead.","messagePattern":"--ai cannot be combined with a resolve subcommand\\. For one conflict, use `but resolve apply <path>\\[:<N>\\] --ai` instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/resolve.rs","lineNumber":57,"sourceCode":"        [] => None,\n        [target] if !conflicted_paths.contains(target) => Some(target.clone()),\n        _ => {\n            if let Some(other) = targets.iter().find(|t| !conflicted_paths.contains(t)) {\n                bail!(\n                    \"'{other}' is not a conflicted uncommitted file; `but resolve` takes either one commit or only conflicted files (see `but status`).\"\n                );\n            }\n            if ai {\n                bail!(\n                    \"Conflicted uncommitted files can only be marked as resolved: `but resolve <path>...`\"\n                );\n            }\n            return mark_worktree_conflicts_resolved(ctx, out, targets);\n        }\n    };\n    if ai {\n        if cmd.is_some() {\n            bail!(\n                \"--ai cannot be combined with a resolve subcommand. For one conflict, use `but resolve apply <path>[:<N>] --ai` instead.\"\n            );\n        }\n        return resolve_with_ai(ctx, out, commit_id.as_deref());\n    }\n    match cmd {\n        Some(Subcommands::Conflicts { commit }) => list_conflicts(ctx, out, commit.as_deref()),\n        Some(Subcommands::Apply {\n            target,\n            commit,\n            ours,\n            theirs,\n            ai,\n            file,\n        }) => {\n            let flags = ResolutionFlags {\n                ours,\n                theirs,","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/resolve.rs#L39-L75","documentation":"The global `--ai` flag is mutually exclusive with `but resolve` subcommands (`conflicts`, `apply`, `cancel`, ...). Passing both bails immediately (resolve.rs:55-59), pointing you to the supported AI form for a single conflict: `but resolve apply <path>[:<N>] --ai`, which carries its own AI flag after the subcommand.","triggerScenarios":"`but resolve --ai conflicts`, `but resolve --ai apply <path>`, or any resolve subcommand placed after the global `--ai` flag.","commonSituations":"Habitual global-flag placement (flags before the subcommand); scripts written for the older bare `--ai` behavior being extended with subcommands.","solutions":["For whole-commit AI resolution use `but resolve --ai <commit-id>` with no subcommand.","For one conflict or hunk use `but resolve apply <path>[:<N>] --ai`.","Drop `--ai` entirely when you genuinely want the subcommand's non-AI behavior."],"exampleFix":"# before\nbut resolve --ai conflicts          # subcommand after global --ai -> not allowed\n\n# after\nbut resolve conflicts               # list conflicts\nbut resolve --ai 4z                 # AI-resolve a whole conflicted commit\nbut resolve apply src/lib.rs:2 --ai # AI-resolve one conflict","handlingStrategy":"validation","validationCode":"# Keep the global --ai and subcommands mutually exclusive in wrappers\nif [[ \"$1\" == '--ai' && \"$2\" =~ ^(conflicts|apply|cancel|finish)$ ]]; then\n  echo '--ai cannot be combined with a resolve subcommand'; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place the global `--ai` only in the commit form `but resolve --ai <commit>`.","For single conflicts use `but resolve apply <path>[:<N>] --ai` (the subcommand's own AI flag)."],"tags":["cli","resolve","ai","flag-combination","gitbutler"],"backgroundTag":"unsupported-flag-combination","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}