{"record":{"id":"280d1b6de07fcbbc","repo":"linebender/druid","slug":"couldn-t-get-visual-from-screen","errorCode":null,"errorMessage":"Couldn't get visual from screen","messagePattern":"Couldn't get visual from screen","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"druid-shell/src/backend/x11/application.rs","lineNumber":303,"sourceCode":"            crosshair: load_cursor(\"crosshair\"),\n            not_allowed: load_cursor(\"not-allowed\"),\n            row_resize: load_cursor(\"row-resize\"),\n            col_resize: load_cursor(\"col-resize\"),\n        };\n\n        let atoms = Rc::new(\n            AppAtoms::new(&*connection)?\n                .reply()\n                .context(\"get X11 atoms\")?,\n        );\n\n        let screen = connection\n            .setup()\n            .roots\n            .get(screen_num)\n            .ok_or_else(|| anyhow!(\"Invalid screen num: {}\", screen_num))?;\n        let root_visual_type = util::get_visual_from_screen(screen)\n            .ok_or_else(|| anyhow!(\"Couldn't get visual from screen\"))?;\n        let argb_visual_type = util::get_argb_visual_type(&connection, screen)?;\n\n        let timestamp = Rc::new(Cell::new(x11rb::CURRENT_TIME));\n        let pending_events = Default::default();\n        let clipboard = Clipboard::new(\n            Rc::clone(&connection),\n            screen_num,\n            Rc::clone(&atoms),\n            atoms.CLIPBOARD,\n            Rc::clone(&pending_events),\n            Rc::clone(&timestamp),\n        );\n        let primary = Clipboard::new(\n            Rc::clone(&connection),\n            screen_num,\n            Rc::clone(&atoms),\n            atoms.PRIMARY,\n            Rc::clone(&pending_events),","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/linebender/druid/blob/0f8b1195e4e073f9597f2865299c3d18f8e4005f/druid-shell/src/backend/x11/application.rs#L285-L321","documentation":"Thrown by Application::new when util::get_visual_from_screen returns None, i.e. the chosen screen's root visual could not be resolved from the X server's setup data. This indicates the screen record lacks a usable root_visual or the lookup failed, so windows cannot be created with a valid visual (depth/colormap combination).","triggerScenarios":"Application::new called against a screen whose root visual id does not resolve in setup().visual_formats / depth lists — typically a broken or exotic X server configuration, a screen obtained incorrectly (e.g. bad screen_num leading to a different code path), or corrupted X11 setup data from a misbehaving proxy (Xvnc, x11vnc, X forwarding).","commonSituations":"Running under VNC/remote-X proxies with incomplete visual setup; running on nested/specialized servers (Xephyr, some Wayland XWayland edge cases); hardware driver misconfiguration leaving no usable root visual; automated environments (Xvfb with unusual -screen depth options).","solutions":["Restart the X server with a standard configuration (default depth 24, e.g. Xvfb :1 -screen 0 1024x768x24).","Try a different screen index via Application::new(None, 0) to rule out a per-screen problem.","Bypass SSH X forwarding / VNC proxies and test against a local X server to confirm the environment is the cause.","If it persists, file an issue with `xdpyinfo` output showing available visuals for the failing screen."],"exampleFix":"// before (headless CI)\nXvfb :1 -screen 0 1024x768x8\n// after\nXvfb :1 -screen 0 1024x768x24","handlingStrategy":"try-catch","validationCode":"// check visuals exist via xdpyinfo output before launching, or at runtime:\nlet setup = conn.setup();\nlet ok = setup.roots.iter().any(|s| util::get_visual_from_screen(s).is_some());","typeGuard":null,"tryCatchPattern":"match Application::new(None, 0) {\n    Ok(app) => app,\n    Err(e) if e.to_string().contains(\"Couldn't get visual from screen\") => {\n        eprintln!(\"X server reports no usable visual; restart X with depth 24\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Run X servers with standard visual configs (default depth 24).","Avoid untested VNC/remote-X proxies in production runs.","Capture xdpyinfo output in diagnostics bundles for reproducibility."],"tags":["x11","visual","display-init"],"backgroundTag":"resource-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"}