loco-rs/loco · error

does not exist

Error message

{} does not exist

What it means

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.

Solutions

  1. Run the xtask from the repository root so `project_dir.join("docs")` resolves
  2. Verify the `docs/` directory exists (`ls docs/`) and has not been renamed
  3. Pass the correct project root path to the tool

Example fix

// before (from repo subdir)
cargo xtask docs-syntax
// after
cd /path/to/repo-root && cargo xtask docs-syntax
Defensive patterns

Strategy: validation

Validate before calling

if !Path::new("docs").is_dir() { panic!("run from repo root: docs/ missing"); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of loco-rs/loco@23639d1e36 (2026-09-12). Data as JSON: /api/errors/270df447ad138fae. Report an issue: GitHub.

Appendix: source

Thrown at xtask/src/docs_syntax.rs:59

/// snippet in the published API docs.
const RUST_DIRS: &[&str] = &["src", "loco-gen/src", "loco-new/src"];
const SKIP_MARKER: &str = "no-syntax-check";

struct Block {
    file: PathBuf,
    /// 1-based line of the opening fence, so the report is clickable.
    line: usize,
    code: String,
    skipped: bool,
}

/// # Errors
/// when the docs tree is missing, a file cannot be read, or any block that
/// did not opt out fails to parse as Rust
pub fn run(project_dir: &Path) -> Result<()> {
    let root = project_dir.join(DOCS_DIR);
    if !root.is_dir() {
        bail!("{} does not exist", root.display());
    }

    let mut blocks = Vec::new();
    collect(&root, &mut blocks)?;
    if blocks.is_empty() {
        bail!(
            "found no ```rust blocks under {} — the extractor is broken, not the docs",
            root.display()
        );
    }

    let before_sources = blocks.len();
    for dir in RUST_DIRS {
        collect(&project_dir.join(dir), &mut blocks)?;
    }
    if blocks.len() == before_sources {
        bail!("found no ```rust blocks in {RUST_DIRS:?} — the extractor is broken, not the docs");
    }

View on GitHub (pinned to 23639d1e36)