{"record":{"id":"478550d12fe27880","repo":"zed-industries/zed","slug":"found-errors-in-docs","errorCode":null,"errorMessage":"Found {} errors in docs","messagePattern":"Found (.+?) errors in docs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/docs_preprocessor/src/main.rs","lineNumber":205,"sourceCode":"    let mut input = String::new();\n    stdin.read_to_string(&mut input)?;\n\n    let (_ctx, mut book) = CmdPreprocessor::parse_input(input.as_bytes())?;\n\n    let mut errors = HashSet::<PreprocessorError>::new();\n    handle_frontmatter(&mut book, &mut errors);\n    template_big_table_of_actions(&mut book);\n    template_and_validate_keybindings(&mut book, &mut errors);\n    template_and_validate_actions(&mut book, &mut errors);\n    template_and_validate_json_snippets(&mut book, &mut errors)?;\n\n    if !errors.is_empty() {\n        const ANSI_RED: &str = \"\\x1b[31m\";\n        const ANSI_RESET: &str = \"\\x1b[0m\";\n        for error in &errors {\n            eprintln!(\"{ANSI_RED}ERROR{ANSI_RESET}: {}\", error);\n        }\n        return Err(anyhow::anyhow!(\"Found {} errors in docs\", errors.len()));\n    }\n\n    serde_json::to_writer(io::stdout(), &book)?;\n\n    Ok(())\n}\n\nfn handle_frontmatter(book: &mut Book, errors: &mut HashSet<PreprocessorError>) {\n    let frontmatter_regex = Regex::new(r\"(?s)^\\s*---(.*?)---\").unwrap();\n    for_each_chapter_mut(book, |chapter| {\n        let new_content = frontmatter_regex.replace(&chapter.content, |caps: &regex::Captures| {\n            let frontmatter = caps[1].trim();\n            let frontmatter = frontmatter.trim_matches(&[' ', '-', '\\n']);\n            let mut metadata = HashMap::<String, String>::default();\n            for line in frontmatter.lines() {\n                let Some((name, value)) = line.split_once(':') else {\n                    errors.insert(PreprocessorError::InvalidFrontmatterLine(format!(\n                        \"{}: {}\",","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/docs_preprocessor/src/main.rs#L187-L223","documentation":"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.","triggerScenarios":"Thrown at crates/docs_preprocessor/src/main.rs:205 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the printed error list to see which docs pages/entries are invalid","Fix the offending keybinding/action definitions or frontmatter and re-run the preprocessor"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}