gitbutlerapp/gitbutler · error
No resolutions were provided
Error message
No resolutions were provided
What it means
This error is thrown by `resolve_commit_conflict_hunks_with` in crates/but-api/src/resolve/mod.rs when the caller passes an empty list of `ResolutionSpec`s. The function exists to apply model- or user-provided resolutions to a commit's conflict hunks, so with no specs there is nothing to do and it fails fast instead of producing a misleading result.
Solutions
- Check `specs.is_empty()` before calling and return a validation error to the caller/UI instead of invoking the API
- Ensure the conflict-resolution UI requires at least one hunk resolution before submitting
- When specs may legitimately be empty after narrowing, skip the call entirely and treat the commit as unresolved
Example fix
// before
api.resolve_commit_conflict_hunks(commit_id, []);
// after
if (specs.length === 0) throw new Error('At least one resolution is required');
api.resolve_commit_conflict_hunks(commit_id, specs); Defensive patterns
Strategy: validation
Validate before calling
if (!specs || specs.length === 0) {
throw new Error('resolve_commit_conflict_hunks requires at least one ResolutionSpec');
} Type guard
const hasSpecs = (s: unknown): s is ResolutionSpec[] => Array.isArray(s) && s.length > 0 && s.every(x => x != null);
Try / catch
try {
await api.resolveCommitConflictHunks(commitId, specs);
} catch (e) {
if (e.message.includes('No resolutions were provided')) {
// surface a validation error instead of retrying
}
} Prevention
- Check spec count at the UI boundary before submitting
- Never submit auto-narrowed specs without a length check
- Treat empty specs as a no-op and skip the API call
When it happens
Trigger: Calling `resolve_commit_conflict_hunks_with(ctx, commit_id, specs, resolve)` with `specs: Vec<ResolutionSpec>` of length 0; typically a wrapper like `resolve_commit_conflict_hunks` receives an empty resolutions array from the client, or an AI pipeline (e.g. `ai_specs_are_narrowed_to_their_hunks_and_applied`) narrows specs down to nothing.
Common situations: A UI sends an empty `resolutions: []` payload because the user clicked resolve without answering conflicts; an AI response yielded no applicable hunks after narrowing; a client filters specs by hunk and filters everything out.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Aborting due to empty
- Need at least 2 commits to squash
- No changes were provided to uncommit
- no commit IDs provided for discard
- no commit IDs provided for discard
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/f2b7100a8af6af9b.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/resolve/mod.rs:345
)?
.context("The AI model returned no response")
})
}
/// Like `resolve_commit_conflict_hunks()`, but with the model call injected
/// as `resolve`, so tests can supply AI resolutions without network access.
///
/// `resolve` is only invoked when `specs` contains [`HunkResolution::Ai`],
/// with a request narrowed to just those hunks; a failed call or response is
/// retried once.
pub fn resolve_commit_conflict_hunks_with(
ctx: &mut but_ctx::Context,
commit_id: gix::ObjectId,
mut specs: Vec<ResolutionSpec>,
resolve: impl Fn(&ResolutionRequest) -> anyhow::Result<ResolutionResponse>,
) -> anyhow::Result<HunkResolutionResult> {
if specs.is_empty() {
bail!("No resolutions were provided");
}
let request = {
let _guard = ctx.shared_worktree_access();
let repo = ctx.repo.get()?;
context::build_request(&repo, commit_id)?
};
let any_ai = resolve_ai_specs(&request, &mut specs, &resolve)?;
let picks = apply::validate_specs(&request, &specs)?;
// Every spec addressed a distinct hunk, or validation would have failed.
let resolved = specs.len();
let operation = if any_ai {
OperationKind::ResolveConflictsAi
} else {
OperationKind::ResolveConflicts
};
let mut guard = ctx.exclusive_worktree_access();
ctx.invalidate_workspace_cache()?;View on GitHub (pinned to 58e5313667)