gitbutlerapp/gitbutler · error
Conflicted uncommitted files can only be marked as…
Error message
Conflicted uncommitted files can only be marked as resolved: `but resolve <path>...`
What it means
When all given targets are conflicted uncommitted files, `--ai` cannot be used because AI resolution only works against a commit, not worktree conflicts. The command bails to redirect the user to plain path-based resolution.
Solutions
- Drop `--ai` and run `but resolve <path>...` to mark files resolved manually
- If AI help is wanted for a commit's conflict, use `but resolve <commit-id> --ai`
Example fix
// before but resolve src/app.rs --ai // after but resolve src/app.rs
Defensive patterns
Strategy: validation
Validate before calling
if ai_flag && targets.iter().all(|t| conflicted_paths.contains(t)) {
eprintln!("--ai cannot be used for worktree-conflicted files; drop --ai");
} Try / catch
if let Err(e) = run_resolve(args) {
if e.to_string().contains("--ai") {
eprintln!("Remove --ai for path-based resolve, or target a commit instead");
}
} Prevention
- Use `--ai` only with a commit ID target
- Keep AI and manual resolve flows separate in scripts
- Read `but resolve --help` for flag/subcommand compatibility
When it happens
Trigger: `but resolve <conflicted-path>... --ai` where every target is a conflicted uncommitted file.
Common situations: Users assume `--ai` works everywhere and append it to a file-based resolve command.
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
- --ai cannot be combined with a resolve subcommand. For one…
- 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/9fa18d169e26d251.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/resolve.rs:48
ai: bool,
) -> Result<()> {
// Conflicted uncommitted files are marked resolved; anything else is a commit.
let conflicted_paths = if targets.is_empty() {
Vec::new()
} else {
conflicted_worktree_paths(ctx)?
};
let commit_id = match targets.as_slice() {
[] => 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,View on GitHub (pinned to 58e5313667)