{"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":"validation","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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/resolve.rs#L39-L75","documentation":"Flag-combination validation in the resolve handler: --ai was passed together with a resolve subcommand, which is unsupported. AI resolution works per-conflict via 'but resolve apply <path>[:<N>] --ai' instead of a subcommand invocation.","triggerScenarios":"`but resolve apply <path>[:<N>] --ai` (or any subcommand) instead of `but resolve apply <path>[:<N>] --ai` alone — i.e. any cmd plus --ai.","commonSituations":"Mixing the subcommand syntax with the AI flag; copying an example that uses either feature and adding both.","solutions":["Use `but resolve apply <path>[:<N>] --ai` for AI resolution of a single conflict","Run subcommands (apply/skip/finish) without `--ai`","Use plain `but resolve <commit> --ai` for AI resolution at commit level"],"exampleFix":"// before\nbut resolve finish --ai\n// after\nbut resolve finish          # subcommand without --ai\nbut resolve <commit> --ai   # AI resolution without subcommand","handlingStrategy":"validation","validationCode":"if ai_flag && subcommand.is_some() {\n    eprintln!(\"use 'but resolve apply <path>[:<N>] --ai' for AI single-conflict resolution\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_resolve(args) {\n    if e.to_string().contains(\"cannot be combined\") {\n        eprintln!(\"Split the invocation: subcommand OR --ai, not both\");\n    }\n}","preventionTips":["Treat --ai as mutually exclusive with resolve subcommands","For single-conflict AI resolution use `apply <path>[:<N>] --ai`","Validate argument combinations in wrapper scripts before shelling out"],"tags":["cli","flags","conflict"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}