zed-industries/zed · error

Found errors in docs

Error message

Found {} errors in docs

What it means

After running all docs preprocessor passes, the accumulated PreprocessorError set is non-empty; the CLI prints the errors and exits reporting 'Found N errors in docs'. It is the aggregate failure signal for invalid keybindings, actions, or frontmatter discovered in the mdbook documentation.

Solutions

  1. Inspect the printed error list to see which docs pages/entries are invalid
  2. Fix the offending keybinding/action definitions or frontmatter and re-run the preprocessor
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/docs_preprocessor/src/main.rs:205 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/478550d12fe27880. Report an issue: GitHub.

Appendix: source

Thrown at crates/docs_preprocessor/src/main.rs:205

    let mut input = String::new();
    stdin.read_to_string(&mut input)?;

    let (_ctx, mut book) = CmdPreprocessor::parse_input(input.as_bytes())?;

    let mut errors = HashSet::<PreprocessorError>::new();
    handle_frontmatter(&mut book, &mut errors);
    template_big_table_of_actions(&mut book);
    template_and_validate_keybindings(&mut book, &mut errors);
    template_and_validate_actions(&mut book, &mut errors);
    template_and_validate_json_snippets(&mut book, &mut errors)?;

    if !errors.is_empty() {
        const ANSI_RED: &str = "\x1b[31m";
        const ANSI_RESET: &str = "\x1b[0m";
        for error in &errors {
            eprintln!("{ANSI_RED}ERROR{ANSI_RESET}: {}", error);
        }
        return Err(anyhow::anyhow!("Found {} errors in docs", errors.len()));
    }

    serde_json::to_writer(io::stdout(), &book)?;

    Ok(())
}

fn handle_frontmatter(book: &mut Book, errors: &mut HashSet<PreprocessorError>) {
    let frontmatter_regex = Regex::new(r"(?s)^\s*---(.*?)---").unwrap();
    for_each_chapter_mut(book, |chapter| {
        let new_content = frontmatter_regex.replace(&chapter.content, |caps: &regex::Captures| {
            let frontmatter = caps[1].trim();
            let frontmatter = frontmatter.trim_matches(&[' ', '-', '\n']);
            let mut metadata = HashMap::<String, String>::default();
            for line in frontmatter.lines() {
                let Some((name, value)) = line.split_once(':') else {
                    errors.insert(PreprocessorError::InvalidFrontmatterLine(format!(
                        "{}: {}",

View on GitHub (pinned to f4178619ac)