{"record":{"id":"2026e2dd4fbb2365","repo":"emilk/egui","slug":"no-fonts-available-until-first-call-to-context-ru","errorCode":null,"errorMessage":"No fonts available until first call to Context::run()","messagePattern":"No fonts available until first call to Context::run\\(\\)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/egui/src/context.rs","lineNumber":1103,"sourceCode":"    ///\n    /// This is swapped at the end of each pass.\n    #[inline]\n    pub(crate) fn prev_pass_state<R>(&self, reader: impl FnOnce(&PassState) -> R) -> R {\n        self.write(move |ctx| reader(&ctx.viewport().prev_pass))\n    }\n\n    /// Read-only access to [`Fonts`].\n    ///\n    /// Not valid until first call to [`Context::run_ui()`].\n    /// That's because since we don't know the proper `pixels_per_point` until then.\n    #[inline]\n    pub fn fonts<R>(&self, reader: impl FnOnce(&FontsView<'_>) -> R) -> R {\n        self.write(move |ctx| {\n            let pixels_per_point = ctx.pixels_per_point();\n            reader(\n                &ctx.fonts\n                    .as_mut()\n                    .expect(\"No fonts available until first call to Context::run()\")\n                    .with_pixels_per_point(pixels_per_point),\n            )\n        })\n    }\n\n    /// Read-write access to [`Fonts`].\n    ///\n    /// Not valid until first call to [`Context::run_ui()`].\n    /// That's because since we don't know the proper `pixels_per_point` until then.\n    #[inline]\n    pub fn fonts_mut<R>(&self, reader: impl FnOnce(&mut FontsView<'_>) -> R) -> R {\n        self.write(move |ctx| {\n            let pixels_per_point = ctx.pixels_per_point();\n            reader(\n                &mut ctx\n                    .fonts\n                    .as_mut()\n                    .expect(\"No fonts available until first call to Context::run()\")","sourceCodeStart":1085,"sourceCodeEnd":1121,"githubUrl":"https://github.com/emilk/egui/blob/d802a982ce959839d92f4f6718fdffa41143110e/crates/egui/src/context.rs#L1085-L1121","documentation":"Error \"No fonts available until first call to Context::run()\" thrown in emilk/egui.","triggerScenarios":"Thrown at crates/egui/src/context.rs:1103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d802a982ce959839d92f4f6718fdffa41143110e","analyzedAt":"2026-08-16T20:07:53.954Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}