{"record":{"id":"6e812fc118ea835f","repo":"rust-lang/mdBook","slug":"failed-to-get-key-e","errorCode":null,"errorMessage":"failed to get `{key}`: {e}","messagePattern":"failed to get `(.+?)`: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mdbook-driver/src/mdbook.rs","lineNumber":567,"sourceCode":"fn preprocessor_should_run(\n    preprocessor: &dyn Preprocessor,\n    renderer: &dyn Renderer,\n    cfg: &Config,\n) -> Result<bool> {\n    // default preprocessors should be run by default (if supported)\n    if cfg.build.use_default_preprocessors && is_default_preprocessor(preprocessor) {\n        return preprocessor.supports_renderer(renderer.name());\n    }\n\n    let key = format!(\"preprocessor.{}.renderers\", preprocessor.name());\n    let renderer_name = renderer.name();\n\n    match cfg.get::<Vec<String>>(&key) {\n        Ok(Some(explicit_renderers)) => {\n            Ok(explicit_renderers.iter().any(|name| name == renderer_name))\n        }\n        Ok(None) => preprocessor.supports_renderer(renderer_name),\n        Err(e) => bail!(\"failed to get `{key}`: {e}\"),\n    }\n}\n","sourceCodeStart":549,"sourceCodeEnd":570,"githubUrl":"https://github.com/rust-lang/mdBook/blob/dc21064fc21d955a0e1f67e65e336883c3e5260b/crates/mdbook-driver/src/mdbook.rs#L549-L570","documentation":"preprocessor_should_run() reads the `preprocessor.<name>.renderers` list via Config::get(); if that read errors (e.g. the value has the wrong type and cannot deserialize to Vec<String>, or get() was given an invalid key) the error is wrapped with this context.","triggerScenarios":"book.toml containing `renderers = \"html\"` (a string instead of an array) or other non-list value under preprocessor.<name>.renderers; nested get() failures from the config layer.","commonSituations":"Hand-edited book.toml with a malformed renderers entry; copying config snippets where renderers is a single string.","solutions":["Change renderers to a TOML array: renderers = [\"html\"]","Remove the renderers key to fall back to the preprocessor's supports_renderer() method","Validate book.toml with `mdbook build` output or TOML linting"],"exampleFix":"// before (book.toml)\n[preprocessor.links]\nrenderers = \"html\"\n// after\n[preprocessor.links]\nrenderers = [\"html\"]","handlingStrategy":"validation","validationCode":"// validate book.toml before build\nlet raw = toml::from_str::<toml::Value>(&std::fs::read_to_string(\"book.toml\")?)?;\nif let Some(r) = raw.get(\"preprocessor\").and_then(|p| p.get(\"links\")).and_then(|l| l.get(\"renderers\")) {\n    assert!(r.is_array(), \"preprocessor.links.renderers must be a TOML array\");\n}","typeGuard":null,"tryCatchPattern":"match preprocessor_should_run(&pp, renderer, &cfg) {\n    Ok(run) => /* ... */,\n    Err(e) if e.to_string().contains(\"failed to get\") => {\n        eprintln!(\"check preprocessor.<name>.renderers is an array: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always write renderers as a TOML array: renderers = [\"html\"]","Never quote booleans or arrays in book.toml","Run mdbook build once after config edits to validate types"],"tags":["config","deserialization"],"backgroundTag":"invalid-config-key","analyzedSha":"dc21064fc21d955a0e1f67e65e336883c3e5260b","analyzedAt":"2026-09-01T10:15:12.134Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}