{"record":{"id":"b740b73229ae8d93","repo":"loco-rs/loco","slug":"found-no-rust-blocks-under-the-extractor-is-broken-not-the","errorCode":null,"errorMessage":"found no ```rust blocks under {} — the extractor is broken, not the docs","messagePattern":"found no ```rust blocks under (.+?) — the extractor is broken, not the docs","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/docs_syntax.rs","lineNumber":65,"sourceCode":"    /// 1-based line of the opening fence, so the report is clickable.\n    line: usize,\n    code: String,\n    skipped: bool,\n}\n\n/// # Errors\n/// when the docs tree is missing, a file cannot be read, or any block that\n/// did not opt out fails to parse as Rust\npub fn run(project_dir: &Path) -> Result<()> {\n    let root = project_dir.join(DOCS_DIR);\n    if !root.is_dir() {\n        bail!(\"{} does not exist\", root.display());\n    }\n\n    let mut blocks = Vec::new();\n    collect(&root, &mut blocks)?;\n    if blocks.is_empty() {\n        bail!(\n            \"found no ```rust blocks under {} — the extractor is broken, not the docs\",\n            root.display()\n        );\n    }\n\n    let before_sources = blocks.len();\n    for dir in RUST_DIRS {\n        collect(&project_dir.join(dir), &mut blocks)?;\n    }\n    if blocks.len() == before_sources {\n        bail!(\"found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs\");\n    }\n\n    let mut failures = Vec::new();\n    let mut checked = 0;\n    let mut skipped = 0;\n\n    for block in &blocks {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/loco-rs/loco/blob/23639d1e360dbc618073642b507d6f8664adbaff/xtask/src/docs_syntax.rs#L47-L83","documentation":"The docs-syntax checker found the `docs/` tree but zero ```rust code blocks in it. Since Loco's documentation is expected to be full of Rust examples, an empty extraction means the markdown parsing/extractor logic is broken rather than the docs genuinely having no Rust code.","triggerScenarios":"Running the checker when `collect()` returns no blocks from `docs/` — typically after a change to the markdown parsing (closing-fence regex, opening fence detection) or after docs were replaced with non-markdown content.","commonSituations":"After refactoring `docs_syntax.rs` and breaking fence matching; after bulk-converting docs to another format; git history surgery that emptied the docs tree.","solutions":["Check the ```rust fence detection regex/`collect` function in xtask/src/docs_syntax.rs for regressions","Verify docs/ actually contains markdown files with ```rust fenced blocks","Diff the extractor against the last known-good version of docs_syntax.rs"],"exampleFix":"// before\nlet closing = Regex::new(r\"^```\").unwrap(); // too narrow, never matches\n// after\nlet closing = Regex::new(r\"^\\s*```\\s*$\").unwrap();","handlingStrategy":"validation","validationCode":"let n = count_rust_fences(\"docs\"); assert!(n > 0, \"docs tree has no ```rust blocks\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add tests for the fence-extraction regexes in docs_syntax.rs","Never bulk-replace docs content without keeping ```rust blocks"],"tags":["docs","tooling","markdown","regression"],"backgroundTag":"empty-result-set","analyzedSha":"23639d1e360dbc618073642b507d6f8664adbaff","analyzedAt":"2026-09-12T01:47:20.769Z","contentChangedAt":"2026-09-12T01:47:20.769Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}