{"record":{"id":"2c21e68f8be16613","repo":"rust-lang/mdBook","slug":"is-reserved-for-internal-use","errorCode":null,"errorMessage":"{} is reserved for internal use","messagePattern":"(.+?) is reserved for internal use","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mdbook-html/src/html_handlebars/hbs_renderer.rs","lineNumber":43,"sourceCode":"    /// Returns a new instance of [`HtmlHandlebars`].\n    pub fn new() -> Self {\n        HtmlHandlebars\n    }\n\n    fn render_chapter(\n        &self,\n        chapter_tree: &ChapterTree<'_>,\n        prev_ch: Option<&Chapter>,\n        next_ch: Option<&Chapter>,\n        mut ctx: RenderChapterContext<'_>,\n    ) -> Result<()> {\n        // FIXME: This should be made DRY-er and rely less on mutable state\n        let ch = chapter_tree.chapter;\n\n        let path = ch.path.as_ref().unwrap();\n        // \"print.html\" is used for the print page.\n        if path == Path::new(\"print.md\") {\n            bail!(\"{} is reserved for internal use\", path.display());\n        };\n\n        if let Some(ref edit_url_template) = ctx.html_config.edit_url_template {\n            let full_path = ctx.book_config.src.to_str().unwrap_or_default().to_owned()\n                + \"/\"\n                + ch.source_path\n                    .clone()\n                    .unwrap_or_default()\n                    .to_str()\n                    .unwrap_or_default();\n\n            let edit_url = edit_url_template.replace(\"{path}\", &full_path);\n            ctx.data\n                .insert(\"git_repository_edit_url\".to_owned(), json!(edit_url));\n        }\n\n        let mut content = String::new();\n        serialize(&chapter_tree.tree, &mut content);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/rust-lang/mdBook/blob/dc21064fc21d955a0e1f67e65e336883c3e5260b/crates/mdbook-html/src/html_handlebars/hbs_renderer.rs#L25-L61","documentation":"When rendering chapters, the handlebars renderer bails if a chapter's source path is \"print.md\", because that filename is reserved by mdbook for the aggregated print page. Allowing it would collide with the generated print.html output, so the render fails fast with this error.","triggerScenarios":"Having a file named print.md inside the book's src/ directory (whether referenced in SUMMARY.md or discovered as a draft/extra chapter) and running mdbook build or mdbook serve with HTML output enabled.","commonSituations":"Users creating a printable chapter literally named print.md, migration from tools that used print.md as a page name, or copying content files that clash with mdbook's reserved output name.","solutions":["Rename src/print.md to something else (e.g. src/printing.md) and update its SUMMARY.md entry.","If the file was accidental, delete it from src/.","Search the book for links referencing print.md and update them to the new filename.","Rebuild after the rename to confirm rendering succeeds."],"exampleFix":"// before\nmv src/print.md src/print-page.md\n# SUMMARY.md\n- [Print](./print.md)\n\n// after\n# SUMMARY.md\n- [Print](./print-page.md)","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn assert_no_reserved_files(src: &Path) -> anyhow::Result<()> {\n    let print_md = src.join(\"print.md\");\n    if print_md.exists() {\n        anyhow::bail!(\"{} is reserved for internal use; rename it\", print_md.display());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"// guard build invocation for tooling that runs mdbook build\nlet out = Command::new(\"mdbook\").arg(\"build\").output()?;\nif !out.status.success() {\n    let msg = String::from_utf8_lossy(&out.stderr);\n    if msg.contains(\"reserved for internal use\") {\n        eprintln!(\"rename src/print.md — mdbook reserves it for the print page\");\n    }\n}","preventionTips":["Never name chapters print.md (or print.html) in src/.","Add a CI check that fails if src/print.md exists.","Grep SUMMARY.md for reserved names before publishing."],"tags":["configuration","reserved-filename","build","html-render"],"backgroundTag":"reserved-filename-conflict","analyzedSha":"dc21064fc21d955a0e1f67e65e336883c3e5260b","analyzedAt":"2026-09-01T10:15:12.134Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}