gitbutlerapp/gitbutler · error
" " has conflicts; content applies to one at a time, use "…
Error message
"{path}" has {total_hunks} conflicts; content applies to one at a time, use "{path}:<N>". What it means
When applying a content-based resolution (`<path>:<content>`) to a conflicted file that has more than one conflict hunk, the command refuses: whole-file content only applies unambiguously when there is exactly one hunk. It directs the user to target a specific hunk with `<path>:<N>`. Ours/theirs/Ai resolutions are exempt because they can be applied to every hunk.
Solutions
- Target a single hunk: `but resolve <commit> "<path>:2":<content>`
- Repeat per hunk, or resolve each hunk with ours/theirs
- Resolve in edit mode if per-hunk CLI targeting is impractical
Example fix
// before but resolve <commit-id> "src/main.rs":'resolved full file content' // error: "src/main.rs" has 3 conflicts; content applies to one at a time, use "src/main.rs":<N> // after but resolve <commit-id> "src/main.rs:1":'content for hunk 1' but resolve <commit-id> "src/main.rs:2":'content for hunk 2'
Defensive patterns
Strategy: validation
Validate before calling
const file = conflicts.files.find(f => normalizePath(f.path) === lookupPath);
const hunkCount = file ? file.hunks.length : 0;
if (resolution.kind === 'content' && hunkCount > 1)
throw new Error(`Use "${path}:<N>" per hunk (${hunkCount} hunks)`); Type guard
const canApplyWholeContent = (path, conflicts) => {
const f = conflicts.files.find(f => normalize(f.path) === normalize(path));
return f != null && f.hunks.length === 1;
}; Prevention
- Query hunk count per conflicted file before choosing resolution kind
- For multi-hunk files, always emit per-hunk targets `<path>:<N>` in scripts
- Prefer ours/theirs for blanket resolutions across all hunks
When it happens
Trigger: `but resolve <commit> <path>:<content>` (or via the API HunkResolution::Content) where conflicts.files lookup shows total_hunks > 1.
Common situations: Pasting resolved file content for a file with several conflict markers; script that assumes a single conflict block per file.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Branch " " has no conflicted commits.
- Cannot push branch ' ': the push would include conflicted…
- Commit is not conflicted.
- Could not find stack containing commit
- No conflicted commits found.
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/47aeca1e9b45aa28.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/resolve.rs:963
.find(|file| but_api::resolve::normalize_path(&file.path) == lookup)
{
bail!(
"\"{path}\" cannot be resolved this way: {} Resolve this commit in edit mode instead.",
manual.reason
);
}
let total_hunks = conflicts
.files
.iter()
.find(|conflicted| but_api::resolve::normalize_path(&conflicted.path) == lookup)
.map(|conflicted| conflicted.hunks.len())
.with_context(|| format!("\"{path}\" is not a conflicted file of this commit"))?;
match &resolution {
HunkResolution::Ours | HunkResolution::Theirs | HunkResolution::Ai => {
(1..=total_hunks).collect()
}
HunkResolution::Content(_) if total_hunks == 1 => vec![1],
HunkResolution::Content(_) => bail!(
"\"{path}\" has {total_hunks} conflicts; content applies to one at a time, use \"{path}:<N>\"."
),
}
}
};
let specs = hunks
.into_iter()
.map(|hunk| ResolutionSpec {
path: path.to_owned(),
hunk,
resolution: resolution.clone(),
})
.collect();
let result = but_api::resolve::resolve_commit_conflict_hunks(ctx, commit_oid, specs)?;
if let Some(human_out) = out.for_human() {
let repo = ctx.repo.get()?;View on GitHub (pinned to 58e5313667)