gitbutlerapp/gitbutler · error
--ai cannot be combined with a resolve subcommand. For one…
Error message
--ai cannot be combined with a resolve subcommand. For one conflict, use `but resolve apply <path>[:<N>] --ai` instead.
What it means
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.
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
Example fix
// before but resolve finish --ai // after but resolve finish # subcommand without --ai but resolve <commit> --ai # AI resolution without subcommand
Defensive patterns
Strategy: validation
Validate before calling
if ai_flag && subcommand.is_some() {
eprintln!("use 'but resolve apply <path>[:<N>] --ai' for AI single-conflict resolution");
} Try / catch
if let Err(e) = run_resolve(args) {
if e.to_string().contains("cannot be combined") {
eprintln!("Split the invocation: subcommand OR --ai, not both");
}
} Prevention
- 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
When it happens
Trigger: `but resolve apply <path>[:<N>] --ai` (or any subcommand) instead of `but resolve apply <path>[:<N>] --ai` alone — i.e. any cmd plus --ai.
Common situations: Mixing the subcommand syntax with the AI flag; copying an example that uses either feature and adding both.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- Conflicted uncommitted files can only be marked as…
- Cannot pass both --local and --global
- Cannot use both --detect and --path options together
- Cannot use both --fix-formatting and --message flags…
- Commit is not in a conflicted state. Only conflicted…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/aa7ab53788c951b5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/resolve.rs:57
[] => None,
[target] if !conflicted_paths.contains(target) => Some(target.clone()),
_ => {
if let Some(other) = targets.iter().find(|t| !conflicted_paths.contains(t)) {
bail!(
"'{other}' is not a conflicted uncommitted file; `but resolve` takes either one commit or only conflicted files (see `but status`)."
);
}
if ai {
bail!(
"Conflicted uncommitted files can only be marked as resolved: `but resolve <path>...`"
);
}
return mark_worktree_conflicts_resolved(ctx, out, targets);
}
};
if ai {
if cmd.is_some() {
bail!(
"--ai cannot be combined with a resolve subcommand. For one conflict, use `but resolve apply <path>[:<N>] --ai` instead."
);
}
return resolve_with_ai(ctx, out, commit_id.as_deref());
}
match cmd {
Some(Subcommands::Conflicts { commit }) => list_conflicts(ctx, out, commit.as_deref()),
Some(Subcommands::Apply {
target,
commit,
ours,
theirs,
ai,
file,
}) => {
let flags = ResolutionFlags {
ours,
theirs,View on GitHub (pinned to 58e5313667)