{"record":{"id":"6f03cbf654ca1f8b","repo":"zed-industries/zed","slug":"markers-start-id-and-end-id-belong-to-diff","errorCode":null,"errorMessage":"markers `{start_id}` and `{end_id}` belong to different context snippets that are not contiguous excerpts of the same file","messagePattern":"markers `(.+?)` and `(.+?)` belong to different context snippets that are not contiguous excerpts of the same file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeta_prompt/src/hashed_regions.rs","lineNumber":677,"sourceCode":"    let snippets = merge_contiguous_snippets(input, marker_table)?;\n    let mut marker_index: HashMap<&str, (usize, usize)> = HashMap::new();\n    for (snippet_ix, snippet) in snippets.iter().enumerate() {\n        for (id, offset) in &snippet.markers {\n            marker_index.insert(id.as_str(), (snippet_ix, *offset));\n        }\n    }\n\n    let mut edits: Vec<ParsedSpanEdit> = Vec::new();\n    for (start_id, end_id, raw_new_span) in spans {\n        let &(start_snippet, start_byte) = marker_index\n            .get(start_id.as_str())\n            .with_context(|| format!(\"unknown start marker `{start_id}`\"))?;\n        let &(end_snippet, end_byte) = marker_index\n            .get(end_id.as_str())\n            .with_context(|| format!(\"unknown end marker `{end_id}`\"))?;\n\n        if start_snippet != end_snippet {\n            return Err(anyhow!(\n                \"markers `{start_id}` and `{end_id}` belong to different context snippets \\\n                 that are not contiguous excerpts of the same file\"\n            ));\n        }\n        if start_byte > end_byte {\n            return Err(anyhow!(\n                \"start marker `{start_id}` must come before end marker `{end_id}`\"\n            ));\n        }\n\n        let old_text = snippets[start_snippet].text.as_ref();\n        let old_span = &old_text[start_byte..end_byte];\n\n        let cursor_in_span = raw_new_span.find(cursor_marker);\n        let mut new_span = raw_new_span.replace(cursor_marker, \"\");\n        if old_span.is_empty() {\n            if !new_span.is_empty() && !new_span.ends_with('\\n') {\n                new_span.push('\\n');","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/zeta_prompt/src/hashed_regions.rs#L659-L695","documentation":"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.","triggerScenarios":"Thrown at crates/zeta_prompt/src/hashed_regions.rs:677 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry so the model uses markers from the same/contiguous snippet"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}