{"record":{"id":"66160778c0a28b21","repo":"emilk/egui","slug":"no-font-data-found-for-name-configured-fonts-available","errorCode":null,"errorMessage":"No font data found for {name:?}. Configured fonts: {available:?}","messagePattern":"No font data found for (.+?)\\. Configured fonts: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/epaint/src/text/font_definitions.rs","lineNumber":249,"sourceCode":"/// The configured fonts are the head of every family's fallback chain:\n/// for each family they are handed out in the order they are listed,\n/// so the same text looks the same on every machine.\n///\n/// [`FontDefinitions`] never discovers anything on demand,\n/// and is always the first [`FontProvider`] asked.\nimpl FontProvider for FontDefinitions {\n    fn fonts_for_family(&self, family: &FontFamily) -> Vec<FontInsert> {\n        let Some(font_names) = self.families.get(family) else {\n            log::warn!(\"FontFamily::{family:?} is not bound to any fonts\");\n            return Vec::new();\n        };\n\n        font_names\n            .iter()\n            .map(|name| {\n                let data = self.font_data.get(name).unwrap_or_else(|| {\n                    let available: Vec<&String> = self.font_data.keys().collect();\n                    panic!(\"No font data found for {name:?}. Configured fonts: {available:?}\")\n                });\n                FontInsert {\n                    name: name.clone(),\n                    data: (**data).clone(),\n                    families: Vec::new(),\n                }\n            })\n            .collect()\n    }\n}\n","sourceCodeStart":231,"sourceCodeEnd":260,"githubUrl":"https://github.com/emilk/egui/blob/441971a776322a482e371775219380eca812cfa9/crates/epaint/src/text/font_definitions.rs#L231-L260","documentation":"`fonts_for_family` looks up each font name registered for a family in `self.font_data` and panics if a name has no corresponding entry. This is an internal consistency check: every name in `FontDefinitions::families` must have an entry in `font_data`, otherwise the family configuration is broken.","triggerScenarios":"Pushing a font name into `FontDefinitions::families` (or configuring fonts via kittest/egui config) without inserting matching data into `font_data` under the exact same string — including case, spaces, and file extension.","commonSituations":"Typos or case mismatches between the family list name and the `font_data` map key; removing a `font_data.insert(...)` while leaving the name in the families vec; copying config from an example with different font keys; serialization round-trips dropping `font_data`.","solutions":["Make sure every name listed in `families` has an identical key in `font_data` — fix typos/case so they match exactly.","If you removed font data, also remove the name from the family's font list.","Use the panic message's `Configured fonts:` list to see the exact valid keys and pick/correct to one of them.","Build the definitions with a helper that inserts data and registers the family name in one place to keep them in sync."],"exampleFix":"// before\nfonts.families.get_mut(&FontFamily::Monospace).unwrap().push(\"JetBrainsMono\".into());\nfonts.font_data.insert(\"JetBrains Mono\".into(), Cow::Owned(data));\n// after\nlet key = \"JetBrainsMono\";\nfonts.font_data.insert(key.to_owned(), Cow::Owned(data));\nfonts.families.get_mut(&FontFamily::Monospace).unwrap().push(key.to_owned());","handlingStrategy":"validation","validationCode":"// Before using definitions, verify family names all resolve\nfor (family, names) in &defs.families {\n    for name in names {\n        assert!(defs.font_data.contains_key(name), \"font {name:?} missing from font_data\");\n    }\n}","typeGuard":"fn fonts_resolvable(defs: &FontDefinitions) -> bool {\n    defs.families.values().flatten().all(|n| defs.font_data.contains_key(n))\n}","tryCatchPattern":"// Panic-based; check membership before handing definitions to egui\nassert!(defs.font_data.contains_key(font_name), \"register {font_name} in font_data before listing it\");","preventionTips":["Use a single const/key variable for each font name so families and font_data stay in sync.","Add a debug assertion or unit test validating families ⊆ font_data keys.","Copy-paste font keys instead of retyping them; avoid differing file extensions in keys."],"tags":["fonts","panic","configuration","rust"],"backgroundTag":"record-not-found","analyzedSha":"441971a776322a482e371775219380eca812cfa9","analyzedAt":"2026-09-12T04:29:21.500Z","contentChangedAt":"2026-09-12T04:29:21.500Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}