fyne-io/fyne · critical
eglMakeCurrent failed\n
Error message
eglMakeCurrent failed\n
What it means
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).
Source
Thrown at internal/driver/mobile/app/x11.c:124
fprintf(stderr, "eglGetDisplay failed\n");
exit(1);
}
EGLint e_major, e_minor;
if (!eglInitialize(e_dpy, &e_major, &e_minor)) {
fprintf(stderr, "eglInitialize failed\n");
exit(1);
}
eglBindAPI(EGL_OPENGL_ES_API);
win = new_window(x_dpy, e_dpy, 500, 1000, &e_ctx, &e_surf);
wm_delete_window = XInternAtom(x_dpy, "WM_DELETE_WINDOW", True);
if (wm_delete_window != None) {
XSetWMProtocols(x_dpy, win, &wm_delete_window, 1);
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(e_dpy, e_surf, e_surf, e_ctx)) {
fprintf(stderr, "eglMakeCurrent failed\n");
exit(1);
}
// Window size and DPI should be initialized before starting app.
XEvent ev;
while (1) {
if (XCheckMaskEvent(x_dpy, StructureNotifyMask, &ev) == False) {
continue;
}
if (ev.type == ConfigureNotify) {
onResize(ev.xconfigure.width, ev.xconfigure.height);
break;
}
}
}
void
processEvents(void) {View on GitHub (pinned to 8860ee95c3)
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
Example fix
# before: vendor EGL under Xwayland refuses the binding -> exit(1) ./yourapp # eglMakeCurrent failed # after: pin platform and fall back to Mesa software if needed EGL_PLATFORM=x11 ./yourapp EGL_PLATFORM=x11 LIBGL_ALWAYS_SOFTWARE=1 ./yourapp
Defensive patterns
Strategy: validation
Validate before calling
func makeCurrentPreflight() error {
if err := glesPreflight(); err != nil {
return err
}
if os.Getenv("WAYLAND_DISPLAY") != "" {
log.Print("Xwayland detected; prefer EGL_PLATFORM=x11 and current Mesa")
}
return nil
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- eglCreateWindowSurface failed\n
- eglGetConfigAttrib failed\n
- eglCreateContext failed\n
- eglGetDisplay failed\n
- eglChooseConfig failed\n
AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15).
Data as JSON: /api/errors/8d2e3746116d007a.
Report an issue: GitHub.