fyne-io/fyne · critical
eglCreateWindowSurface failed\n
Error message
eglCreateWindowSurface failed\n
What it means
With a context created, x11.c calls eglCreateWindowSurface on the just-created X window using the same config. Failure means EGL refused to bind a window surface to that window/drawable: typically a config-vs-window visual mismatch, an EGL that expects a different platform, or an invalid drawable. The process prints 'eglCreateWindowSurface failed' and exits(1).
Source
Thrown at internal/driver/mobile/app/x11.c:85
XSizeHints sizehints;
sizehints.width = w;
sizehints.height = h;
sizehints.flags = USSize;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, "App", "App", None, (char **)NULL, 0, &sizehints);
static const EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
*ctx = eglCreateContext(e_dpy, config, EGL_NO_CONTEXT, ctx_attribs);
if (!*ctx) {
fprintf(stderr, "eglCreateContext failed\n");
exit(1);
}
*surf = eglCreateWindowSurface(e_dpy, config, win, NULL);
if (!*surf) {
fprintf(stderr, "eglCreateWindowSurface failed\n");
exit(1);
}
return win;
}
Display *x_dpy;
EGLDisplay e_dpy;
EGLContext e_ctx;
EGLSurface e_surf;
Window win;
void
createWindow(void) {
x_dpy = XOpenDisplay(NULL);
if (!x_dpy) {
fprintf(stderr, "XOpenDisplay failed\n");
exit(1);
}View on GitHub (pinned to 8860ee95c3)
Solutions
- Update Mesa / GPU driver to a current release
- Force the X11 platform explicitly: EGL_PLATFORM=x11 ./yourapp
- Run on a native X session (or Xvfb with GLX) rather than a remote display
- Try software rendering to rule out the vendor path: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp
- Ensure nothing destroys the window between creation and surface binding (check for early WM_DELETE or crash in startup hooks)
Example fix
# before: platform auto-detection fails under Xwayland / vendor EGL ./yourapp # eglCreateWindowSurface failed # after: pin the X11 EGL platform explicitly EGL_PLATFORM=x11 ./yourapp
Defensive patterns
Strategy: validation
Validate before calling
func surfacePreflight() error {
if err := glesPreflight(); err != nil {
return err
}
if os.Getenv("WAYLAND_DISPLAY") != "" && os.Getenv("EGL_PLATFORM") == "" {
return fmt.Errorf("Xwayland session detected; set EGL_PLATFORM=x11 before running")
}
return nil
} Prevention
- Export EGL_PLATFORM=x11 in launch scripts for this driver
- Keep Mesa current; surface-creation failures are mostly fixed driver-side
- Do not run the X11 driver against remote X servers without GLX
When it happens
Trigger: eglCreateWindowSurface returning EGL_NO_SURFACE: window depth/visual incompatible with the chosen config under some drivers, EGL auto-platform detection picking the wrong platform (Xwayland quirks), or the window being destroyed before surface creation.
Common situations: Running under Xwayland with vendor EGL; outdated Mesa; apps or window managers closing the window during startup; remote X without GLX where a surface cannot be bound.
Related errors
- eglMakeCurrent failed\n
- eglGetConfigAttrib failed\n
- eglGetDisplay failed\n
- eglChooseConfig failed\n
- XGetVisualInfo failed\n
AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15).
Data as JSON: /api/errors/0d56e71b31845748.
Report an issue: GitHub.