{"record":{"id":"1076345288e25bad","repo":"fyne-io/fyne","slug":"eglchooseconfig-failed-n","errorCode":null,"errorMessage":"eglChooseConfig failed\\n","messagePattern":"eglChooseConfig failed\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/driver/mobile/app/x11.c","lineNumber":33,"sourceCode":"static Atom wm_delete_window;\n\nstatic Window\nnew_window(Display *x_dpy, EGLDisplay e_dpy, int w, int h, EGLContext *ctx, EGLSurface *surf) {\n\tstatic const EGLint attribs[] = {\n\t\tEGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,\n\t\tEGL_SURFACE_TYPE, EGL_WINDOW_BIT,\n\t\tEGL_BLUE_SIZE, 8,\n\t\tEGL_GREEN_SIZE, 8,\n\t\tEGL_RED_SIZE, 8,\n\t\tEGL_ALPHA_SIZE, 8,\n\t\tEGL_DEPTH_SIZE, 16,\n\t\tEGL_CONFIG_CAVEAT, EGL_NONE,\n\t\tEGL_NONE\n\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));","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/app/x11.c#L15-L51","documentation":"First step of window creation in the X11/EGL backend of Fyne's mobile/app package (compiled for (linux && !android) || freebsd || openbsd, file x11.c). eglChooseConfig is asked for exactly one config that is GLES2-renderable, has EGL_WINDOW_BIT, 8-bit RGBA, 16-bit depth and no caveat. If EGL returns no matching config the program prints 'eglChooseConfig failed' to stderr and exits(1).","triggerScenarios":"createWindow() at driver startup when the installed EGL implementation exposes no config matching RGBA8888 + depth16 + window-bit + GLES2: software EGL without depth, RGBX-only configs, or EGL on a display with no GPU support.","commonSituations":"Docker/CI containers with partial Mesa installs (libegl-mesa0 without libgl1-mesa-dri); Xvfb started without the GLX extension; VNC servers; Wayland-only stacks where EGL only advertises Wayland surface types; old or stripped proprietary drivers.","solutions":["Install a complete Mesa userspace: apt install libegl1 libegl-mesa0 libgl1-mesa-dri libgles2 mesa-utils","Verify a matching config exists: eglinfo -B should list an EGL_WINDOW_BIT GLES2 config with alpha and depth","Run with software rendering: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp","Use a real X server with GLX: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX' ./yourapp","If you build this driver yourself, relax the attrib list in x11.c (drop EGL_ALPHA_SIZE or the EGL_CONFIG_CAVEAT line) and retry eglChooseConfig"],"exampleFix":"// before (x11.c): hard requirement of alpha + depth16, exit on no match\nstatic const EGLint attribs[] = {\n\tEGL_SURFACE_TYPE, EGL_WINDOW_BIT,\n\tEGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8,\n\tEGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 16,\n\tEGL_NONE };\nif (!eglChooseConfig(e_dpy, attribs, &config, 1, &num_configs)) { exit(1); }\n\n// after: fall back to a config without alpha, then without depth\nstatic const EGLint attribs_fallback[] = {\n\tEGL_SURFACE_TYPE, EGL_WINDOW_BIT,\n\tEGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8,\n\tEGL_NONE };\nif (!eglChooseConfig(e_dpy, attribs, &config, 1, &num_configs) || num_configs < 1) {\n\tif (!eglChooseConfig(e_dpy, attribs_fallback, &config, 1, &num_configs) || num_configs < 1)\n\t\texit(1);\n}","handlingStrategy":"validation","validationCode":"func eglPreflight() error {\n\tif os.Getenv(\"DISPLAY\") == \"\" {\n\t\treturn fmt.Errorf(\"DISPLAY not set; run under X or xvfb-run\")\n\t}\n\tif err := exec.Command(\"xdpyinfo\").Run(); err != nil {\n\t\treturn fmt.Errorf(\"X server unreachable: %w\", err)\n\t}\n\tout, err := exec.Command(\"eglinfo\", \"-B\").CombinedOutput()\n\tif err != nil || !bytes.Contains(out, []byte(\"OpenGL ES\")) {\n\t\treturn fmt.Errorf(\"no GLES-capable EGL config; install libgl1-mesa-dri libegl-mesa0 libgles2 mesa-utils\")\n\t}\n\treturn nil\n}\n\n// call before creating any window\nif err := eglPreflight(); err != nil {\n\tlog.Fatal(err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bake libegl1, libegl-mesa0, libgl1-mesa-dri, libgles2 and mesa-utils into CI images","Start virtual X with GLX and 24-bit depth: xvfb-run -a -s '-screen 0 1024x768x24 +extension GLX'","Add eglinfo -B as a CI smoke step so config availability is verified before the app runs","Support LIBGL_ALWAYS_SOFTWARE=1 in run scripts as a documented fallback for machines without GPU EGL"],"tags":["c","egl","x11","opengl-es","mesa","headless"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}