{"record":{"id":"270df447ad138fae","repo":"loco-rs/loco","slug":"does-not-exist","errorCode":null,"errorMessage":"{} does not exist","messagePattern":"(.+?) does not exist","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/docs_syntax.rs","lineNumber":59,"sourceCode":"/// snippet in the published API docs.\nconst RUST_DIRS: &[&str] = &[\"src\", \"loco-gen/src\", \"loco-new/src\"];\nconst SKIP_MARKER: &str = \"no-syntax-check\";\n\nstruct Block {\n    file: PathBuf,\n    /// 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    }","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/loco-rs/loco/blob/23639d1e360dbc618073642b507d6f8664adbaff/xtask/src/docs_syntax.rs#L41-L77","documentation":"A `bail!` in the xtask docs-syntax checker that fires when the `docs/` directory cannot be found under the given project directory. The tool walks the docs tree to extract ```rust code blocks, so without the directory it cannot proceed and aborts with the resolved path in the message.","triggerScenarios":"Calling `xtask docs-syntax` (or `run`) with a `project_dir` that does not contain a `docs/` subdirectory, or invoking it from the wrong working directory.","commonSituations":"Running the xtask from a subdirectory instead of the repo root; a renamed or deleted `docs/` folder; passing an incorrect path via a script or CI job.","solutions":["Run the xtask from the repository root so `project_dir.join(\"docs\")` resolves","Verify the `docs/` directory exists (`ls docs/`) and has not been renamed","Pass the correct project root path to the tool"],"exampleFix":"// before (from repo subdir)\ncargo xtask docs-syntax\n// after\ncd /path/to/repo-root && cargo xtask docs-syntax","handlingStrategy":"validation","validationCode":"if !Path::new(\"docs\").is_dir() { panic!(\"run from repo root: docs/ missing\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run xtasks from the repository root","Check docs/ existence in CI before invoking the docs-syntax task"],"tags":["docs","tooling","filesystem","path"],"backgroundTag":"directory-not-found","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"}