gitbutlerapp/gitbutler · error · anyhow::Error

No resolutions were provided

Error message

No resolutions were provided

What it means

resolve_commit_conflict_hunks_with() requires at least one ResolutionSpec; an empty vector is rejected before the repository is even opened. Resolving 'nothing' is a caller bug, not an operation - there is no meaningful snapshot or commit rewrite to make.

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 caf1f223d3)

Solutions

  1. Guard the call site: skip the API when specs is empty and treat it as a no-op
  2. Disable the apply/resolve action in the UI while no conflict is selected
  3. If you expected specs, debug why the list came back empty before reaching the call

Example fix

// before
await api.resolveCommitConflictHunks(commitId, specs); // throws on []

// after
if (specs.length > 0) {
  await api.resolveCommitConflictHunks(commitId, specs);
}
Defensive patterns

Strategy: validation

Validate before calling

// Skip the call entirely when there is nothing to resolve
if (specs.length === 0) {
  return { resolved: 0, skipped: true };
}
await api.resolveCommitConflictHunks(commitId, specs);

Prevention

When it happens

Trigger: Calling resolve_commit_conflict_hunks(ctx, id, &[]) / [] from the SDK, Tauri, or CLI - typically an 'Apply' action firing with nothing selected, or an upstream filter (e.g. removing content specs that failed a client-side check) leaving an empty list that still gets submitted.

Common situations: 'Resolve all remaining' button enabled with an empty selection set; pipelines that build specs conditionally and forget the zero case; tests passing an empty vec while prototyping.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/f2b7100a8af6af9b. Report an issue: GitHub.