{"record":{"id":"e0112c7dc7b2791b","repo":"linebender/druid","slug":"no-window-with-id","errorCode":null,"errorMessage":"No window with id {}","messagePattern":"No window with id (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"druid-shell/src/backend/x11/application.rs","lineNumber":456,"sourceCode":"\n    pub(crate) fn add_window(&self, id: u32, window: Rc<Window>) -> Result<(), Error> {\n        borrow_mut!(self.state)?.windows.insert(id, window);\n        Ok(())\n    }\n\n    /// Remove the specified window from the `Application` and return the number of windows left.\n    fn remove_window(&self, id: u32) -> Result<usize, Error> {\n        let mut state = borrow_mut!(self.state)?;\n        state.windows.remove(&id);\n        Ok(state.windows.len())\n    }\n\n    fn window(&self, id: u32) -> Result<Rc<Window>, Error> {\n        borrow!(self.state)?\n            .windows\n            .get(&id)\n            .cloned()\n            .ok_or_else(|| anyhow!(\"No window with id {}\", id))\n    }\n\n    #[inline]\n    pub(crate) fn connection(&self) -> &Rc<XCBConnection> {\n        &self.connection\n    }\n\n    #[inline]\n    pub(crate) fn screen_num(&self) -> usize {\n        self.screen_num\n    }\n\n    #[inline]\n    pub(crate) fn argb_visual_type(&self) -> Option<Visualtype> {\n        // Check if a composite manager is running\n        let atom_name = format!(\"_NET_WM_CM_S{}\", self.screen_num);\n        let owner = self\n            .connection","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-shell/src/backend/x11/application.rs#L438-L474","documentation":"Thrown by Application::window when a window id received from the X event stream is not present in the application's windows HashMap. The X server can deliver events for windows the backend does not track (foreign windows, windows already destroyed), and the backend surfaces that as this error to handle_event, which typically logs and drops the event.","triggerScenarios":"handle_event receives an XKB/XCB event (keypress, motion, etc.) whose window id is not owned by this Application — e.g. events for a window that was just closed but whose queued events are still draining, or synthetic/grab events targeting other clients' windows.","commonSituations":"Rapidly closing windows while events are in flight; running under window managers that send synthetic events; embedded/multi-window apps interacting with foreign windows via global grabs (screen lockers, screenshot tools).","solutions":["Generally benign: the backend drops the event — upgrade druid/druid-shell if it is noisy (recent versions tolerate it).","Ensure windows are not destroyed while their event loop callbacks still reference them; close windows through the official close API.","If reproducible, log the offending id and check for code that manipulates window ids it doesn't own (e.g. from XQueryPointer or grabs)."],"exampleFix":"// before: treating every window lookup failure as fatal\nlet win = app.window(id).expect(\"window must exist\");\n// after: tolerate events for untracked windows\nif let Ok(win) = app.window(id) { win.handle_event(ev); }","handlingStrategy":"fallback","validationCode":"// caller-side check before acting on a window\nif app.window(id).is_err() { return; } // window already gone","typeGuard":null,"tryCatchPattern":"match app.window(id) {\n    Ok(win) => win.handle_event(ev),\n    Err(_) => { /* window closed or foreign; drop stale event */ }\n}","preventionTips":["Treat missing-window events as benign and log-only.","Close windows via the backend API so state maps stay consistent.","Keep druid-shell updated; newer versions tolerate stale events."],"tags":["x11","event-handling","window-lifecycle"],"backgroundTag":"record-not-found","analyzedSha":"0f8b1195e4e073f9597f2865299c3d18f8e4005f","analyzedAt":"2026-09-10T14:27:34.582Z","contentChangedAt":"2026-09-10T14:27:34.582Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}