zed-industries/zed · error
markers `{start_id}` and `{end_id}` belong to different cont
Error message
markers `{start_id}` and `{end_id}` belong to different context snippets that are not contiguous excerpts of the same file What it means
Raised in build_patch_from_spans(): the start and end markers of a span resolved to different context snippets that are not contiguous excerpts of the same file, so the span would cross a file discontinuity and cannot be applied.
Source
Thrown at crates/zeta_prompt/src/hashed_regions.rs:677
let snippets = merge_contiguous_snippets(input, marker_table)?;
let mut marker_index: HashMap<&str, (usize, usize)> = HashMap::new();
for (snippet_ix, snippet) in snippets.iter().enumerate() {
for (id, offset) in &snippet.markers {
marker_index.insert(id.as_str(), (snippet_ix, *offset));
}
}
let mut edits: Vec<ParsedSpanEdit> = Vec::new();
for (start_id, end_id, raw_new_span) in spans {
let &(start_snippet, start_byte) = marker_index
.get(start_id.as_str())
.with_context(|| format!("unknown start marker `{start_id}`"))?;
let &(end_snippet, end_byte) = marker_index
.get(end_id.as_str())
.with_context(|| format!("unknown end marker `{end_id}`"))?;
if start_snippet != end_snippet {
return Err(anyhow!(
"markers `{start_id}` and `{end_id}` belong to different context snippets \
that are not contiguous excerpts of the same file"
));
}
if start_byte > end_byte {
return Err(anyhow!(
"start marker `{start_id}` must come before end marker `{end_id}`"
));
}
let old_text = snippets[start_snippet].text.as_ref();
let old_span = &old_text[start_byte..end_byte];
let cursor_in_span = raw_new_span.find(cursor_marker);
let mut new_span = raw_new_span.replace(cursor_marker, "");
if old_span.is_empty() {
if !new_span.is_empty() && !new_span.ends_with('\n') {
new_span.push('\n');View on GitHub (pinned to f4178619ac)
Solutions
- Retry so the model uses markers from the same/contiguous snippet
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/zeta_prompt/src/hashed_regions.rs:677 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/6f03cbf654ca1f8b.
Report an issue: GitHub.