gitbutlerapp/gitbutler · error
The model returned no reasoning for
Error message
The model returned no reasoning for "{}" What it means
Every file resolution must include a non-empty `reasoning` string explaining the resolution. `validate_ai_response` bails when `resolution.reasoning.trim().is_empty()`, because GitButler surfaces this explanation to the user reviewing AI-resolved conflicts.
Solutions
- Retry the request with the prompt explicitly requiring a non-empty reasoning string per file
- Patch the response preprocessing to reject/fill empty reasoning before validation (or supply a placeholder only if acceptable)
- Switch to a model known to comply with the response schema
Example fix
// before
{ path: 'a.txt', hunks: [...], reasoning: '' }
// after
{ path: 'a.txt', hunks: [...], reasoning: 'Chose the incoming branch version because ...' } Defensive patterns
Strategy: validation
Validate before calling
if (!response.resolutions.every(r => typeof r.reasoning === 'string' && r.reasoning.trim() !== '')) {
throw new Error('missing reasoning in AI resolution');
} Type guard
const hasReasoning = (r: { reasoning?: string }): r is { reasoning: string } =>
typeof r.reasoning === 'string' && r.reasoning.trim().length > 0; Try / catch
try {
await api.resolveCommitConflictsAi(commitId);
} catch (e) {
if (e.message.includes('no reasoning')) await retryRequiringReasoning();
} Prevention
- Mark reasoning as required in the response schema/prompt
- Reject or regenerate responses with empty reasoning early
- Test with the target model to confirm it always emits reasoning
When it happens
Trigger: The model returns a resolution with `reasoning` missing, empty, or whitespace-only for a file in `resolve_ai_specs` or `resolve_commit_conflicts_with`.
Common situations: A smaller/cheaper model omits optional-looking fields; a custom provider strips reasoning to save tokens; JSON post-processing drops empty strings.
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
- Enter an Anthropic API key
- Enter an OpenAI API key
- executable must be specified for non built-ins
- is required
- id or name must be specified
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/95f763c26afa8199.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/resolve/mod.rs:640
);
};
if resolved_files[index].is_some() {
bail!(
"The model returned more than one resolution for \"{}\"",
resolution.path
);
}
let file = &request.files[index];
if resolution.hunks.len() != file.hunks.len() {
bail!(
"The model returned {} resolved hunks for \"{}\" but the file has {} conflicts",
resolution.hunks.len(),
file.path,
file.hunks.len()
);
}
if resolution.reasoning.trim().is_empty() {
bail!("The model returned no reasoning for \"{}\"", file.path);
}
for (hunk_index, hunk) in resolution.hunks.iter().enumerate() {
apply::ensure_no_markers(&hunk.resolved_content, &file.path)?;
picks[index].insert(
hunk_index,
apply::HunkPick::Content(hunk.resolved_content.clone()),
);
}
resolved_files[index] = Some(ResolvedFile {
path: file.path.clone(),
hunks: resolution
.hunks
.iter()
.map(|hunk| hunk.resolved_content.clone())
.collect(),
reasoning: resolution.reasoning.clone(),
});
}View on GitHub (pinned to 58e5313667)