{"record":{"id":"5a04ec771c178059","repo":"emilk/egui","slug":"failed-to-find-current-viewport-in-egui-rawinput","errorCode":null,"errorMessage":"Failed to find current viewport in egui RawInput. This is the fault of the egui backend","messagePattern":"Failed to find current viewport in egui RawInput\\. This is the fault of the egui backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/egui/src/data/input/raw_input.rs","lineNumber":117,"sourceCode":"            screen_rect: None,\n            max_texture_side: None,\n            time: None,\n            predicted_dt: 1.0 / 60.0,\n            events: vec![],\n            hovered_files: Default::default(),\n            dropped_files: Default::default(),\n            focused: true, // integrations opt into global focus tracking\n            system_theme: None,\n            safe_area_insets: Default::default(),\n        }\n    }\n}\n\nimpl RawInput {\n    /// Info about the active viewport\n    #[inline]\n    pub fn viewport(&self) -> &ViewportInfo {\n        self.viewports.get(&self.viewport_id).expect(\"Failed to find current viewport in egui RawInput. This is the fault of the egui backend\")\n    }\n\n    /// Helper: move volatile (deltas and events), clone the rest.\n    ///\n    /// * [`Self::hovered_files`] is cloned.\n    /// * [`Self::dropped_files`] is moved.\n    pub fn take(&mut self) -> Self {\n        Self {\n            viewport_id: self.viewport_id,\n            viewports: self\n                .viewports\n                .iter_mut()\n                .map(|(id, info)| (*id, info.take()))\n                .collect(),\n            screen_rect: self.screen_rect.take(),\n            safe_area_insets: self.safe_area_insets.take(),\n            max_texture_side: self.max_texture_side.take(),\n            time: self.time,","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/emilk/egui/blob/b9a0723d88dee87ba0965470b554a6efdab1d0bb/crates/egui/src/data/input/raw_input.rs#L99-L135","documentation":"Error \"Failed to find current viewport in egui RawInput. This is the fault of the egui backend\" thrown in emilk/egui.","triggerScenarios":"Thrown at crates/egui/src/data/input/raw_input.rs:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The backend must include the current viewport in RawInput::viewports: if you wrote a custom backend, populate raw_input.viewports with the active ViewportId.","If using an official backend, this is a backend bug: update egui/eframe and report if reproducible."],"exampleFix":"raw_input.viewports.insert(viewport_id, ViewportInfo { parent: None, ..Default::default() });","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b9a0723d88dee87ba0965470b554a6efdab1d0bb","analyzedAt":"2026-08-19T12:39:57.743Z","contentChangedAt":"2026-08-19T12:39:57.743Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}