{"record":{"id":"8d2e3746116d007a","repo":"fyne-io/fyne","slug":"eglmakecurrent-failed-n","errorCode":null,"errorMessage":"eglMakeCurrent failed\\n","messagePattern":"eglMakeCurrent failed\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/driver/mobile/app/x11.c","lineNumber":124,"sourceCode":"\t\tfprintf(stderr, \"eglGetDisplay failed\\n\");\n\t\texit(1);\n\t}\n\tEGLint e_major, e_minor;\n\tif (!eglInitialize(e_dpy, &e_major, &e_minor)) {\n\t\tfprintf(stderr, \"eglInitialize failed\\n\");\n\t\texit(1);\n\t}\n\teglBindAPI(EGL_OPENGL_ES_API);\n\twin = new_window(x_dpy, e_dpy, 500, 1000, &e_ctx, &e_surf);\n\n\twm_delete_window = XInternAtom(x_dpy, \"WM_DELETE_WINDOW\", True);\n\tif (wm_delete_window != None) {\n\t\tXSetWMProtocols(x_dpy, win, &wm_delete_window, 1);\n\t}\n\n\tXMapWindow(x_dpy, win);\n\tif (!eglMakeCurrent(e_dpy, e_surf, e_surf, e_ctx)) {\n\t\tfprintf(stderr, \"eglMakeCurrent failed\\n\");\n\t\texit(1);\n\t}\n\n\t// Window size and DPI should be initialized before starting app.\n\tXEvent ev;\n\twhile (1) {\n\t\tif (XCheckMaskEvent(x_dpy, StructureNotifyMask, &ev) == False) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (ev.type == ConfigureNotify) {\n\t\t\tonResize(ev.xconfigure.width, ev.xconfigure.height);\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nvoid\nprocessEvents(void) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/app/x11.c#L106-L142","documentation":"The last setup step in createWindow(): after mapping the window, x11.c calls eglMakeCurrent(e_dpy, e_surf, e_surf, e_ctx). Failure means the freshly created context/surface pair could not be bound: window already gone, driver refusing the binding (Xwayland/vendor quirks), or surface/context built against incompatible paths. The process prints 'eglMakeCurrent failed' and exits(1).","triggerScenarios":"eglMakeCurrent returning false right after window map: window destroyed before the first ConfigureNotify was processed, vendor EGL under Xwayland rejecting the binding, or contexts/surface created against different EGL displays after platform detection issues.","commonSituations":"Window managers closing/reparenting the window during startup; Xwayland sessions with proprietary drivers; race where the app exits or the display drops between surface creation and first make-current.","solutions":["Update Mesa and the GPU driver (this is nearly always a driver-level binding failure)","Run on native X rather than Xwayland if on a proprietary stack","Force software rendering to bypass the vendor path: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp","Make sure startup code does not close or destroy the window before the event loop starts","Set EGL_PLATFORM=x11 to keep display/platform consistent"],"exampleFix":"# before: vendor EGL under Xwayland refuses the binding -> exit(1)\n./yourapp  # eglMakeCurrent failed\n\n# after: pin platform and fall back to Mesa software if needed\nEGL_PLATFORM=x11 ./yourapp\nEGL_PLATFORM=x11 LIBGL_ALWAYS_SOFTWARE=1 ./yourapp","handlingStrategy":"validation","validationCode":"func makeCurrentPreflight() error {\n\tif err := glesPreflight(); err != nil {\n\t\treturn err\n\t}\n\tif os.Getenv(\"WAYLAND_DISPLAY\") != \"\" {\n\t\tlog.Print(\"Xwayland detected; prefer EGL_PLATFORM=x11 and current Mesa\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep Mesa and GPU drivers updated on kiosk/long-running machines","Never close or destroy the driver's window from your own code during startup","Pin EGL_PLATFORM=x11 to keep display, surface and context on one platform"],"tags":["c","egl","x11","context","xwayland","driver"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}