{"record":{"id":"ed505840837340a5","repo":"Comfy-Org/ComfyUI","slug":"eglmakecurrent-failed","errorCode":null,"errorMessage":"eglMakeCurrent() failed","messagePattern":"eglMakeCurrent\\(\\) failed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_glsl.py","lineNumber":288,"sourceCode":"            ) 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),\n            )\n            if not self._surface:\n                raise RuntimeError(\"eglCreatePbufferSurface() failed\")\n\n            self._context = EGL.eglCreateContext(\n                self._display, config, EGL.EGL_NO_CONTEXT,\n                _egl_attribs(EGL.EGL_CONTEXT_CLIENT_VERSION, 3),\n            )\n            if not self._context:\n                raise RuntimeError(\"eglCreateContext() failed\")\n\n            if not EGL.eglMakeCurrent(self._display, self._surface, self._surface, self._context):\n                raise RuntimeError(\"eglMakeCurrent() failed\")\n\n            self._vao = gl.glGenVertexArrays(1)\n            gl.glBindVertexArray(self._vao)\n\n        except Exception:\n            self._cleanup()\n            raise\n\n        elapsed = (time.perf_counter() - start) * 1000\n\n        renderer = _gl_str(gl.GL_RENDERER)\n        vendor = _gl_str(gl.GL_VENDOR)\n        version = _gl_str(gl.GL_VERSION)\n\n        GLContext._initialized = True\n        logger.info(f\"GLSL context initialized in {elapsed:.1f}ms - EGL {self._egl_major}.{self._egl_minor}, {renderer} ({vendor}), GL {version}\")\n\n    def make_current(self):","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_glsl.py#L270-L306","documentation":"Raised during GLContext initialization when eglMakeCurrent() fails right after the surface and context were successfully created. Making a pbuffer surface current on the just-created GLES3 context failed, which typically indicates the context is not compatible with the surface/config pair, the thread already has a current context, or the driver is in a bad state. Initialization aborts and _cleanup() releases the partially built context.","triggerScenarios":"Another EGL/GL context is already current on the same thread (e.g. another library initialized OpenGL first); context and surface created from configs with incompatible surface types; driver race during early process lifetime; running under a display server/session where the EGL vendor library requires a platform display that was not the one used.","commonSituations":"Loading GL-dependent extensions alongside other OpenGL-using Python libraries (e.g. moderngl, pyrender) in the same process; running ComfyUI inside environments where CUDA/EGLOverlay interop has claimed the EGL context.","solutions":["Isolate the GLSL nodes in a separate process/run so no other library holds an EGL context on the thread.","Update GPU drivers (this exact make-current failure is a known symptom of older NVIDIA EGL implementations).","Verify with a minimal script that eglMakeCurrent works with the installed stack; if it fails there too, fix the EGL installation (packages, vendor JSON) rather than the workflow.","Avoid the GLSL nodes on hosts where only broken software EGL is available."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    _ = GLContext()  # first GLSL use\nexcept RuntimeError as e:\n    if \"eglMakeCurrent\" in str(e) and \"EGL error\" not in str(e):\n        log_and_report(\"EGL context init failed — likely conflicting GL library or driver issue\", e)\n    raise","preventionTips":["Do not mix other OpenGL-using Python libraries (moderngl, pyrender) into the same process as GLSL nodes.","Test one GLSL node right after startup so init problems surface early, not mid-batch.","Keep GPU drivers current."],"tags":["egl","opengl","context","driver","glsl"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}