zed-industries/zed · error
No edit history hunks found in response
Error message
No edit history hunks found in response
What it means
Bailed while parsing the Claude-style generation response in synthesize: the `EDIT_HISTORY:` section was missing from the response or contained no parseable fenced diff block. The response template requires fenced diff blocks under both `EDIT_HISTORY:` and `EXPECTED_PATCH:`; an example is only usable when both parse.
Source
Thrown at crates/edit_prediction_cli/src/synthesize.rs:588
.map(|l| l.strip_prefix("NAME:").unwrap_or("").trim().to_string())
.unwrap_or_else(|| "unnamed example".to_string());
// Parse ANALYSIS section (Claude's planning) - this is the primary reasoning
let reasoning = extract_section(
response,
"ANALYSIS:",
&["NAME:", "REASONING:", "EDIT_HISTORY:", "EXPECTED_PATCH:"],
)
.unwrap_or_default();
// Parse EDIT_HISTORY diff block
let edit_history_hunks = extract_diff_block(response, "EDIT_HISTORY:")?;
// Parse EXPECTED_PATCH diff block
let expected_patch_hunks = extract_diff_block(response, "EXPECTED_PATCH:")?;
if edit_history_hunks.is_empty() {
anyhow::bail!("No edit history hunks found in response");
}
if expected_patch_hunks.is_empty() {
anyhow::bail!("No expected patch hunks found in response");
}
Ok(Some(ClaudeResponse {
name,
reasoning,
edit_history_hunks,
expected_patch_hunks,
}))
}
fn extract_section(text: &str, start_marker: &str, end_markers: &[&str]) -> Option<String> {
let start_idx = text.find(start_marker)?;
let content_start = start_idx + start_marker.len();
let end_idx = end_markersView on GitHub (pinned to f4178619ac)
Solutions
- Inspect the raw model response to see what was actually produced under EDIT_HISTORY:
- Retry generation — single-shot format misses are often stochastic
- Tighten the prompt's output-format instructions with a concrete filled-in example
- If responses are truncated, raise the max output tokens for the generation call
Defensive patterns
Strategy: retry
Validate before calling
if !response.contains("EDIT_HISTORY:") || !has_fenced_block_after(response, "EDIT_HISTORY:") {
// regenerate before attempting to parse
} Try / catch
On this parse bail, log the raw response, retry generation (optionally feeding the parse failure back as a corrective message), and only drop the sample after a bounded number of retries.
Prevention
- Pre-check responses for the required section markers before parsing
- Include a complete filled-in example in the generation prompt
- Set max output tokens high enough that EDIT_HISTORY is never truncated away
When it happens
Trigger: The generation model omits the EDIT_HISTORY section, writes it without a fenced code block, or truncates the response (max output tokens) before reaching it — extract_diff_block then returns no hunks.
Common situations: Model not following the output template; response cut off by a token limit; prompt format drift after switching models; heading renamed by the model.
Related errors
- No expected patch hunks found in response
- No diff blocks found in section {}
- sweep prompt {field_name} contains reserved tokens
- --languages and/or --extensions is required (use --list to s
- unknown teacher backend `{s}`. Valid options: sonnet45, sonn
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/037dd2777fde3d16.
Report an issue: GitHub.