{"record":{"id":"ad3c3dc8ccd13c52","repo":"zed-industries/zed","slug":"unexpected-indented-codeblock","errorCode":null,"errorMessage":"Unexpected indented codeblock","messagePattern":"Unexpected indented codeblock","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction/src/example_spec.rs","lineNumber":363,"sourceCode":"                Event::End(TagEnd::Heading(HeadingLevel::H4)) => {\n                    mem::take(&mut text);\n                }\n                Event::End(TagEnd::Heading(level)) => {\n                    anyhow::bail!(\"Unexpected heading level: {level}\");\n                }\n                Event::Start(Tag::CodeBlock(kind)) => {\n                    if current_section == Section::EditHistory\n                        && text.trim() == ACCEPTED_PREDICTION_MARKER\n                    {\n                        next_edit_predicted = true;\n                    }\n                    text.clear();\n                    match kind {\n                        CodeBlockKind::Fenced(info) => {\n                            block_info = info;\n                        }\n                        CodeBlockKind::Indented => {\n                            anyhow::bail!(\"Unexpected indented codeblock\");\n                        }\n                    };\n                }\n                Event::Start(_) => {\n                    text.clear();\n                    block_info = \"\".into();\n                }\n                Event::End(TagEnd::CodeBlock) => {\n                    let block_info = block_info.trim();\n                    match current_section {\n                        Section::UncommittedDiff => {\n                            spec.uncommitted_diff = mem::take(&mut text);\n                        }\n                        Section::RecentlyOpenedFiles => {\n                            spec.recently_opened_files = parse_path_list(&text);\n                            text.clear();\n                        }\n                        Section::RecentlyViewedFiles => {","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction/src/example_spec.rs#L345-L381","documentation":"While parsing an edit-prediction example spec, a code block that is indented rather than fenced has no info string, so the parser cannot know which section field the block belongs to and bails immediately (example_spec.rs:363). Only fenced code blocks with an info tag carry meaning in these specs.","triggerScenarios":"A spec markdown containing a tab/4-space indented code block (pulldown-cmark's CodeBlockKind::Indented) anywhere the parser walks — typically from content pasted from an editor that auto-indents code.","commonSituations":"Pasting snippets from terminals or editors that convert to indented blocks; reformatting specs with prettier-style tools that may produce indented blocks; hand-writing specs without fences.","solutions":["Convert the indented block into a fenced block with the correct info string for its section.","Re-run the parser to verify no other indented blocks remain.","Configure your editor/markdown formatter to always emit fenced code blocks in these files."],"exampleFix":"    def handle(self):        // before — indented block, bails\n        return None\n\n```python\ndef handle(self):            // after — fenced block with info string\n    return None\n```","handlingStrategy":"validation","validationCode":"# flag indented code blocks before the parser does\nawk '/^(    |\\t)/ && !/^```/ { print FILENAME \":\" FNR \": indented code\"; exit 1 }' examples/*.md","typeGuard":"fn is_fenced(kind: &CodeBlockKind) -> bool {\n    matches!(kind, CodeBlockKind::Fenced(_))\n}","tryCatchPattern":null,"preventionTips":["Always author spec code blocks as fenced blocks with an explicit info string.","Configure markdown formatters to never emit indented code blocks.","Add a CI grep/lint for leading-tab/4-space code blocks in spec dirs."],"tags":["edit-prediction","markdown","example-spec","parsing"],"backgroundTag":"markdown-parsing-failed","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"}