{"record":{"id":"a85ab424681a2312","repo":"Comfy-Org/ComfyUI","slug":"eglbindapi-egl-opengl-es-api-failed","errorCode":null,"errorMessage":"eglBindAPI(EGL_OPENGL_ES_API) failed","messagePattern":"eglBindAPI\\(EGL_OPENGL_ES_API\\) failed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_glsl.py","lineNumber":257,"sourceCode":"        return cls._instance\n\n    def __init__(self):\n        if GLContext._initialized:\n            return\n\n        import time\n        start = time.perf_counter()\n\n        self._display = None\n        self._surface = None\n        self._context = None\n        self._vao = None\n\n        try:\n            self._display, self._egl_major, self._egl_minor = _get_egl_display()\n\n            if not EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API):\n                raise RuntimeError(\"eglBindAPI(EGL_OPENGL_ES_API) failed\")\n\n            config = EGL.EGLConfig()\n            n_configs = ctypes.c_int32(0)\n            if not EGL.eglChooseConfig(\n                self._display,\n                _egl_attribs(\n                    EGL.EGL_RENDERABLE_TYPE, EGL.EGL_OPENGL_ES3_BIT,\n                    EGL.EGL_SURFACE_TYPE, EGL.EGL_PBUFFER_BIT,\n                    EGL.EGL_RED_SIZE, 8, EGL.EGL_GREEN_SIZE, 8,\n                    EGL.EGL_BLUE_SIZE, 8, EGL.EGL_ALPHA_SIZE, 8,\n                ),\n                ctypes.byref(config), 1, ctypes.byref(n_configs),\n            ) or n_configs.value == 0:\n                raise RuntimeError(\"eglChooseConfig() failed\")\n\n            self._surface = EGL.eglCreatePbufferSurface(\n                self._display, config,\n                _egl_attribs(EGL.EGL_WIDTH, 64, EGL.EGL_HEIGHT, 64),","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_glsl.py#L239-L275","documentation":"Raised during GLSL renderer initialization when eglBindAPI(EGL_OPENGL_ES_API) returns false after an EGL display was successfully obtained. The display enumerated fine, but the EGL driver refused to bind OpenGL ES as the rendering API — typically a driver/library mismatch (e.g., a GLES-incompatible EGL implementation, missing libGLESv2, or mixed glvnd/non-glvnd libraries).","triggerScenarios":"Initializing the GLSL context on a system whose EGL implementation does not support the OpenGL ES API: missing libGLESv2/libGLESv3, an EGL library from a different vendor than the GL libraries, or a broken glvnd setup. The display-init step succeeded, so this is specifically the API-bind stage failing.","commonSituations":"Containers with libEGL installed but no GLES libraries; mixing Mesa EGL with proprietary GL libs; partial driver upgrades leaving mismatched versions.","solutions":["Install the GLES runtime: libgles2 / libgles3 and matching libegl-mesa0 (or vendor equivalents).","Reinstall/align the GPU driver stack so EGL and GLES libraries come from the same vendor version.","Verify outside ComfyUI with a minimal eglBindAPI test or eglinfo -B to confirm GLES support.","As a last resort on problematic hosts, run under a software path (llvmpipe/Mesa softpipe) to confirm the pipeline, then fix the driver."],"exampleFix":"# debian/ubuntu: ensure GLES + EGL agree\napt-get install -y libegl1 libegl-mesa0 libgles2 libglesv2-c2 mesa-utils\neglinfo -B   # should list an OpenGL ES platform","handlingStrategy":"try-catch","validationCode":"import ctypes\nfrom OpenGL import EGL\n\ndef gles_bindable() -> bool:\n    d = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY)\n    m, n = ctypes.c_int32(0), ctypes.c_int32(0)\n    if not d or not EGL.eglInitialize(d, ctypes.byref(m), ctypes.byref(n)):\n        return False\n    return bool(EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API))","typeGuard":null,"tryCatchPattern":"try:\n    renderer = GlslRenderer()\nexcept RuntimeError as e:\n    if 'eglBindAPI' in str(e):\n        install_gles_runtime()  # libgles2/libglesv2 + matching libegl\n        renderer = GlslRenderer()\n    else:\n        raise","preventionTips":["Install GLES libraries alongside EGL (same vendor/version set).","Avoid mixing glvnd and legacy driver libraries in one image.","Test eglBindAPI in deployment smoke tests for GLSL-dependent features."],"tags":["egl","opengl","gles","driver","environment"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}