{"record":{"id":"58b1d26f1795a2b4","repo":"fyne-io/fyne","slug":"eglcreatecontext-failed-n","errorCode":null,"errorMessage":"eglCreateContext failed\\n","messagePattern":"eglCreateContext failed\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/driver/mobile/app/x11.c","lineNumber":80,"sourceCode":"\tWindow win = XCreateWindow(\n\t\tx_dpy, root, 0, 0, w, h, 0, visInfo->depth, InputOutput,\n\t\tvisInfo->visual, CWColormap | CWEventMask, &attr);\n\tXFree(visInfo);\n\n\tXSizeHints sizehints;\n\tsizehints.width  = w;\n\tsizehints.height = h;\n\tsizehints.flags = USSize;\n\tXSetNormalHints(x_dpy, win, &sizehints);\n\tXSetStandardProperties(x_dpy, win, \"App\", \"App\", None, (char **)NULL, 0, &sizehints);\n\n\tstatic const EGLint ctx_attribs[] = {\n\t\tEGL_CONTEXT_CLIENT_VERSION, 2,\n\t\tEGL_NONE\n\t};\n\t*ctx = eglCreateContext(e_dpy, config, EGL_NO_CONTEXT, ctx_attribs);\n\tif (!*ctx) {\n\t\tfprintf(stderr, \"eglCreateContext failed\\n\");\n\t\texit(1);\n\t}\n\t*surf = eglCreateWindowSurface(e_dpy, config, win, NULL);\n\tif (!*surf) {\n\t\tfprintf(stderr, \"eglCreateWindowSurface failed\\n\");\n\t\texit(1);\n\t}\n\treturn win;\n}\n\nDisplay *x_dpy;\nEGLDisplay e_dpy;\nEGLContext e_ctx;\nEGLSurface e_surf;\nWindow win;\n\nvoid\ncreateWindow(void) {","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/fyne-io/fyne/blob/8860ee95c356385effa5a7be51adb11c6be9d2b6/internal/driver/mobile/app/x11.c#L62-L98","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: EGL has config but no GLES2 client API -> exit(1)\n./yourapp  # eglCreateContext failed\n\n# after: install GLES runtime and fall back to software if needed\nsudo apt install libgles2 libegl-mesa0 mesa-utils\neglinfo | grep -i 'client api'\nLIBGL_ALWAYS_SOFTWARE=1 ./yourapp","handlingStrategy":"validation","validationCode":"func glesPreflight() error {\n\tout, err := exec.Command(\"sh\", \"-c\", \"eglinfo | grep -i 'client api'\").CombinedOutput()\n\tif err != nil || !bytes.Contains(out, []byte(\"OpenGL ES\")) {\n\t\treturn fmt.Errorf(\"EGL lacks a GLES client API; install libgles2 libegl-mesa0 or set LIBGL_ALWAYS_SOFTWARE=1\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["c","egl","opengl-es","mesa","driver","context"],"backgroundTag":null,"analyzedSha":"8860ee95c356385effa5a7be51adb11c6be9d2b6","analyzedAt":"2026-08-15T22:01:51.624Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}