{"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":null,"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/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/resolve/mod.rs#L327-L363","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\napi.resolve_commit_conflict_hunks(commit_id, []);\n// after\nif (specs.length === 0) throw new Error('At least one resolution is required');\napi.resolve_commit_conflict_hunks(commit_id, specs);","handlingStrategy":"validation","validationCode":"if (!specs || specs.length === 0) {\n  throw new Error('resolve_commit_conflict_hunks requires at least one ResolutionSpec');\n}","typeGuard":"const hasSpecs = (s: unknown): s is ResolutionSpec[] =>\n  Array.isArray(s) && s.length > 0 && s.every(x => x != null);","tryCatchPattern":"try {\n  await api.resolveCommitConflictHunks(commitId, specs);\n} catch (e) {\n  if (e.message.includes('No resolutions were provided')) {\n    // surface a validation error instead of retrying\n  }\n}","preventionTips":["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"],"tags":["validation","conflict-resolution","empty-input"],"backgroundTag":"empty-required-field","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}