zed-industries/zed · error

output does not contain a marker-bounded span

Error message

output does not contain a marker-bounded span

What it means

Raised in pair_marker_spans when parsing model output as a marker-bounded patch: marker tags were found but they cannot be paired into complete start/end spans (odd count, nesting, or missing end tag). The raw output contains no well-formed marker-bounded region to extract an edit from.

Source

Thrown at crates/zeta_prompt/src/hashed_regions.rs:609

    /// 0-based row where the snippet starts in its file.
    pub start_row: u32,
}

/// One marker-bounded edit resolved against a parse snippet.
struct ParsedSpanEdit {
    snippet_ix: usize,
    range: Range<usize>,
    new_text: String,
    cursor_offset_in_new_text: Option<usize>,
}

/// Split raw model output into marker-bounded spans by pairing marker tags two
/// at a time. Returns `(start_id, end_id, raw_new_span)` per pair, where
/// `raw_new_span` may still contain the cursor marker.
fn pair_marker_spans(output: &str) -> Result<Vec<(String, String, String)>> {
    let tags = find_all_marker_tags(output);
    if tags.len() < 2 {
        return Err(anyhow!("output does not contain a marker-bounded span"));
    }
    let mut spans = Vec::new();
    let mut i = 0;
    while i + 1 < tags.len() {
        let (start_id, _, start_tag_end) = &tags[i];
        let (end_id, end_tag_start, _) = &tags[i + 1];
        let content = &output[*start_tag_end..*end_tag_start];
        let content = content.strip_prefix('\n').unwrap_or(content);
        let content = multi_region::strip_marker_tags(content);
        spans.push((start_id.clone(), end_id.clone(), content));
        i += 2;
    }
    Ok(spans)
}

/// Find every marker tag in `text`, in order, as `(id, tag_start, tag_end)`.
fn find_all_marker_tags(text: &str) -> Vec<(String, usize, usize)> {
    let mut tags = Vec::new();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Retry the model request so it emits matched start/end markers
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeta_prompt/src/hashed_regions.rs:609 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/8ab50dda6ddd1ff2. Report an issue: GitHub.