{"record":{"id":"f2b7100a8af6af9b","repo":"gitbutlerapp/gitbutler","slug":"no-resolutions-were-provided","errorCode":null,"errorMessage":"No resolutions were provided","messagePattern":"No resolutions were provided","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-api/src/resolve/mod.rs","lineNumber":345,"sourceCode":"        )?\n        .context(\"The AI model returned no response\")\n    })\n}\n\n/// Like `resolve_commit_conflict_hunks()`, but with the model call injected\n/// as `resolve`, so tests can supply AI resolutions without network access.\n///\n/// `resolve` is only invoked when `specs` contains [`HunkResolution::Ai`],\n/// with a request narrowed to just those hunks; a failed call or response is\n/// retried once.\npub fn resolve_commit_conflict_hunks_with(\n    ctx: &mut but_ctx::Context,\n    commit_id: gix::ObjectId,\n    mut specs: Vec<ResolutionSpec>,\n    resolve: impl Fn(&ResolutionRequest) -> anyhow::Result<ResolutionResponse>,\n) -> anyhow::Result<HunkResolutionResult> {\n    if specs.is_empty() {\n        bail!(\"No resolutions were provided\");\n    }\n    let request = {\n        let _guard = ctx.shared_worktree_access();\n        let repo = ctx.repo.get()?;\n        context::build_request(&repo, commit_id)?\n    };\n    let any_ai = resolve_ai_specs(&request, &mut specs, &resolve)?;\n    let picks = apply::validate_specs(&request, &specs)?;\n    // Every spec addressed a distinct hunk, or validation would have failed.\n    let resolved = specs.len();\n    let operation = if any_ai {\n        OperationKind::ResolveConflictsAi\n    } else {\n        OperationKind::ResolveConflicts\n    };\n\n    let mut guard = ctx.exclusive_worktree_access();\n    ctx.invalidate_workspace_cache()?;","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-api/src/resolve/mod.rs#L327-L363","documentation":"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.","triggerScenarios":"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.","commonSituations":"'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.","solutions":["Guard the call site: skip the API when specs is empty and treat it as a no-op","Disable the apply/resolve action in the UI while no conflict is selected","If you expected specs, debug why the list came back empty before reaching the call"],"exampleFix":"// before\nawait api.resolveCommitConflictHunks(commitId, specs); // throws on []\n\n// after\nif (specs.length > 0) {\n  await api.resolveCommitConflictHunks(commitId, specs);\n}","handlingStrategy":"validation","validationCode":"// Skip the call entirely when there is nothing to resolve\nif (specs.length === 0) {\n  return { resolved: 0, skipped: true };\n}\nawait api.resolveCommitConflictHunks(commitId, specs);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable apply/resolve actions while the selection is empty","When specs are built through filters, branch on the empty result before calling","Treat hitting this error as a caller bug, not an environment problem"],"tags":["conflict-resolution","empty-input","validation","resolve-api"],"backgroundTag":"empty-input-array","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}