{"record":{"id":"119a7fec9780bf59","repo":"linebender/druid","slug":"invalid-screen-num-119a7f","errorCode":null,"errorMessage":"invalid screen num: {}","messagePattern":"invalid screen num: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"druid-shell/src/backend/x11/application.rs","lineNumber":406,"sourceCode":"\n    #[inline]\n    pub(crate) fn present_opcode(&self) -> Option<u8> {\n        self.present_opcode\n    }\n\n    /// Return the ARGB32 pictformat of the server, but only if RENDER's CreateCursor is supported\n    #[inline]\n    pub(crate) fn render_argb32_pictformat_cursor(&self) -> Option<Pictformat> {\n        self.render_argb32_pictformat_cursor\n    }\n\n    fn create_event_window(conn: &Rc<XCBConnection>, screen_num: usize) -> Result<u32, Error> {\n        let id = conn.generate_id()?;\n        let setup = conn.setup();\n        let screen = setup\n            .roots\n            .get(screen_num)\n            .ok_or_else(|| anyhow!(\"invalid screen num: {}\", screen_num))?;\n\n        // Create the actual window\n        conn.create_window(\n            // Window depth\n            x11rb::COPY_FROM_PARENT.try_into().unwrap(),\n            // The new window's ID\n            id,\n            // Parent window of this new window\n            screen.root,\n            // X-coordinate of the new window\n            0,\n            // Y-coordinate of the new window\n            0,\n            // Width of the new window\n            1,\n            // Height of the new window\n            1,\n            // Border width","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-shell/src/backend/x11/application.rs#L388-L424","documentation":"Thrown by the internal create_event_window helper when the screen_num index is out of bounds of the X connection's roots (setup().roots.get returned None). This is the same class of failure as Application::new's \"Invalid screen num\", but occurs while creating the special event/multiplexing window, so it surfaces after the application has already validated its own screen argument.","triggerScenarios":"create_event_window invoked with a screen_num larger than the number of screens the X server reports — e.g. a screen index captured before an X server restart (screens reduced), or a mismatch between the screen stored in Application state and the live connection.","commonSituations":"Long-running processes after the X server restarted with a different configuration; X11 forwarding sessions whose screen count changed; environments using multi-screen DISPLAY values (e.g. :0.1) that the new server doesn't support.","solutions":["Reconnect/restart the application after any X server restart so it re-reads the current screen configuration.","Use screen index 0 or validate against setup().roots.len() before creating windows.","Verify the DISPLAY environment variable matches the actual server's screen layout (xdpyinfo | grep dimensions per screen)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let n = conn.setup().roots.len();\nif screen_num >= n { return Err(anyhow!(\"screen_num {} >= {} screens\", screen_num, n)); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reinitialize the application after X server restarts instead of reusing stale screen ids.","Validate DISPLAY-derived screen numbers against the live connection.","Keep screen indices in one validated place rather than passing them through many layers."],"tags":["x11","screen-index","invalid-argument-value"],"backgroundTag":"invalid-argument-value","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"}