fyne-io/fyne · critical
eglCreateContext failed\n
Error message
eglCreateContext failed\n
What it means
x11.c requests an OpenGL ES 2 client context (EGL_CONTEXT_CLIENT_VERSION 2) with eglCreateContext. Failure means the EGL implementation could not provide a GLES2 context on this display: no GLES2 runtime present, a desktop-GL-only EGL (typical of older proprietary drivers), or a driver/config mismatch. The process prints 'eglCreateContext failed' and exits(1).
Source
Thrown at internal/driver/mobile/app/x11.c:80
Window win = XCreateWindow(
x_dpy, root, 0, 0, w, h, 0, visInfo->depth, InputOutput,
visInfo->visual, CWColormap | CWEventMask, &attr);
XFree(visInfo);
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) {View on GitHub (pinned to 8860ee95c3)
Solutions
- Install the GLES2 runtime: apt install libgles2 libgl1-mesa-dri libegl-mesa0
- Force Mesa software GLES: LIBGL_ALWAYS_SOFTWARE=1 ./yourapp
- Verify which client APIs EGL offers: eglinfo should list OpenGL ES 2.x
- Update the proprietary driver if on NVIDIA/AMD stacks lacking EGL GLES entries
- Set EGL_PLATFORM=x11 so the correct platform display is initialized
Example fix
# before: EGL has config but no GLES2 client API -> exit(1) ./yourapp # eglCreateContext failed # after: install GLES runtime and fall back to software if needed sudo apt install libgles2 libegl-mesa0 mesa-utils eglinfo | grep -i 'client api' LIBGL_ALWAYS_SOFTWARE=1 ./yourapp
Defensive patterns
Strategy: validation
Validate before calling
func glesPreflight() error {
out, err := exec.Command("sh", "-c", "eglinfo | grep -i 'client api'").CombinedOutput()
if err != nil || !bytes.Contains(out, []byte("OpenGL ES")) {
return fmt.Errorf("EGL lacks a GLES client API; install libgles2 libegl-mesa0 or set LIBGL_ALWAYS_SOFTWARE=1")
}
return nil
} Prevention
- Install libgles2/libegl-mesa0 in deploy and CI images by default
- Document LIBGL_ALWAYS_SOFTWARE=1 as the fallback for desktop-GL-only proprietary drivers
- Verify client APIs with eglinfo after any driver change
When it happens
Trigger: eglCreateContext returning EGL_NO_CONTEXT after a valid config was chosen: missing libGLESv2/GLES2 support in Mesa, NVIDIA's EGL historically exposing only desktop GL client APIs, or a broken GLES loader.
Common situations: Containers or minimal installs without the libgles2 package; machines with proprietary drivers lacking GLES; mixed Mesa/NVIDIA ICD setups where eglChooseConfig succeeded against the wrong vendor.
Related errors
- eglGetConfigAttrib failed\n
- eglChooseConfig failed\n
- eglGetDisplay failed\n
- eglInitialize failed\n
- eglMakeCurrent failed\n
AI-assisted analysis of fyne-io/fyne@8860ee95c3 (2026-08-15).
Data as JSON: /api/errors/58b1d26f1795a2b4.
Report an issue: GitHub.