gitbutlerapp/gitbutler · error
Conflicted uncommitted files can only be marked as resolved:
Error message
Conflicted uncommitted files can only be marked as resolved: `but resolve <path>...`
What it means
AI resolution (`--ai`) works on commit conflicts only. When the targets are conflicted uncommitted files (worktree conflicts), `but resolve` can only mark them as resolved — you edit the content yourself — so combining those paths with `--ai` bails with this guidance (resolve.rs:45-51).
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 caf1f223d3)
Solutions
- Drop `--ai`: edit the files, then `but resolve <path>...` to mark them resolved.
- If the conflicts belong to a commit, target the commit instead: `but resolve --ai <commit-id>`.
- For a single conflict inside a commit, use `but resolve apply <path>[:<N>] --ai`.
Example fix
# before but resolve --ai src/lib.rs # uncommitted conflict -> can only be marked resolved # after but resolve src/lib.rs # mark resolved after editing the file but resolve --ai 4z # AI-resolve a conflicted commit
Defensive patterns
Strategy: validation
Validate before calling
# --ai only for commit targets; if your target is listed as a conflicted file, do not pass --ai but resolve conflicts
Prevention
- Reserve `--ai` for commit targets; uncommitted conflicts follow the edit-then-mark flow.
- Check `but resolve conflicts`: paths listed there take the non-AI flow.
When it happens
Trigger: `but resolve --ai <conflicted-file-path>...` — the global AI flag together with worktree-conflict paths instead of a single commit ID.
Common situations: Assuming `--ai` applies to merge-conflict markers in uncommitted files; re-running an old command line after the conflict moved from a commit into the worktree.
Related errors
- --ai cannot be combined with a resolve subcommand. For one c
- '{other}' is not a conflicted uncommitted file; `but resolve
- In resolution mode, edit the files and run `but resolve fini
- Commit '{commit_id_str}' not found. Try running 'but status'
- Commit ID '{commit_id_str}' is ambiguous. Please provide mor
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/9fa18d169e26d251.
Report an issue: GitHub.