{"record":{"id":"2caff0b2d7668e4f","repo":"fyne-io/fyne","slug":"xgetvisualinfo-failed-n","errorCode":null,"errorMessage":"XGetVisualInfo failed\\n","messagePattern":"XGetVisualInfo failed\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/driver/mobile/app/x11.c","lineNumber":47,"sourceCode":"\t};\n\tEGLConfig config;\n\tEGLint num_configs;\n\tif (!eglChooseConfig(e_dpy, attribs, &config, 1, &num_configs)) {\n\t\tfprintf(stderr, \"eglChooseConfig failed\\n\");\n\t\texit(1);\n\t}\n\tEGLint vid;\n\tif (!eglGetConfigAttrib(e_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {\n\t\tfprintf(stderr, \"eglGetConfigAttrib failed\\n\");\n\t\texit(1);\n\t}\n\n\tXVisualInfo visTemplate;\n\tvisTemplate.visualid = vid;\n\tint num_visuals;\n\tXVisualInfo *visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);\n\tif (!visInfo) {\n\t\tfprintf(stderr, \"XGetVisualInfo failed\\n\");\n\t\texit(1);\n\t}\n\n\tWindow root = RootWindow(x_dpy, DefaultScreen(x_dpy));\n\tXSetWindowAttributes attr;\n\n\tattr.colormap = XCreateColormap(x_dpy, root, visInfo->visual, AllocNone);\n\tif (!attr.colormap) {\n\t\tfprintf(stderr, \"XCreateColormap failed\\n\");\n\t\texit(1);\n\t}\n\n\tattr.event_mask = StructureNotifyMask | ExposureMask |\n\t\tButtonPressMask | ButtonReleaseMask | ButtonMotionMask;\n\tWindow win = XCreateWindow(\n\t\tx_dpy, root, 0, 0, w, h, 0, visInfo->depth, InputOutput,\n\t\tvisInfo->visual, CWColormap | CWEventMask, &attr);\n\tXFree(visInfo);","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/app/x11.c#L29-L65","documentation":"x11.c takes the EGL native visual id and calls XGetVisualInfo with VisualIDMask to obtain the X visual for window creation. If the X server has no visual with that id, the call returns NULL and the process prints 'XGetVisualInfo failed' and exits(1). The EGL and X stacks disagree about which visual to use.","triggerScenarios":"EGL reports a native visual id that does not exist on the connected X server: Xvfb with a limited set of visuals, remote X displays, mismatched vendor EGL vs the server's visuals, or unusual depths (16-bit displays).","commonSituations":"Running under plain Xvfb or VNC without full 24-bit TrueColor; NVIDIA proprietary EGL over a remote/ssh-forwarded display; multi-monitor X servers with per-screen visuals.","solutions":["Run on an X server with standard 24-bit TrueColor visuals (check xdpyinfo | grep -A5 visuals)","Start virtual X with adequate visuals: xvfb-run -a -s '-screen 0 1024x768x24' ./yourapp","Force software Mesa so EGL picks visuals the server actually has: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp","Update Mesa/vendor driver to fix EGL/X visual mismatches","Patch x11.c to fall back to the default visual when XGetVisualInfo finds nothing"],"exampleFix":"// before (x11.c): exit when no X visual matches the EGL visual id\nXVisualInfo *visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);\nif (!visInfo) { fprintf(stderr, \"XGetVisualInfo failed\\n\"); exit(1); }\n\n// after: retry with the screen's default visual\nXVisualInfo *visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);\nif (!visInfo) {\n\tvisTemplate.visualid = XVisualIDFromVisual(DefaultVisual(x_dpy, DefaultScreen(x_dpy)));\n\tvisInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);\n\tif (!visInfo) { exit(1); }\n}","handlingStrategy":"validation","validationCode":"func visualPreflight() error {\n\tout, err := exec.Command(\"sh\", \"-c\", \"xdpyinfo | grep -c 'TrueColor'\").Output()\n\tif err != nil || strings.TrimSpace(string(out)) == \"0\" {\n\t\treturn fmt.Errorf(\"X server has no TrueColor visuals; use 24-bit depth (xvfb -screen 0 1024x768x24)\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run virtual X servers at 24-bit depth so TrueColor visuals exist","Prefer local displays over remote/forwarded ones for GPU apps","Check xdpyinfo visuals when setting up new display environments"],"tags":["c","x11","egl","visual","xvfb","headless"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}