{"record":{"id":"3129f0270e241de4","repo":"Comfy-Org/ComfyUI","slug":"eglcreatepbuffersurface-failed","errorCode":null,"errorMessage":"eglCreatePbufferSurface() failed","messagePattern":"eglCreatePbufferSurface\\(\\) failed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_glsl.py","lineNumber":278,"sourceCode":"            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),\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","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_glsl.py#L260-L296","documentation":"Raised during one-time initialization of the GLContext singleton in the GLSL render nodes. After eglChooseConfig() succeeds with a pbuffer-capable GLES3 config, eglCreatePbufferSurface() is asked for a tiny 64x64 offscreen surface to keep the context current; the driver refused it and returned EGL_NO_SURFACE. This is an environment/driver problem, not a workflow problem: the selected EGL implementation cannot back a pbuffer surface with the chosen config.","triggerScenarios":"First execution of any GLSL node (e.g. the fragment-shader render node) in a headless process where the EGL vendor library advertises GLES3 renderable configs but cannot actually create pbuffer surfaces; mixed-driver setups (NVIDIA GL + Mesa EGL or vice versa); remote/headless servers with no accessible GPU and a broken EGL fallback; ANGLE/driver mismatch where eglChooseConfig picked a config whose surface type is not truly supported.","commonSituations":"Running ComfyUI in a Docker container or SSH session without libegl-mesa/libgles installed correctly; NVIDIA headless drivers missing libnvidia-egl-wayland or EGL vendor config; X-forwarding setups where EGL default display has no pbuffer support.","solutions":["Verify EGL/GLES drivers: install libegl1/libegl-mesa0 and libgles2 (Debian/Ubuntu) or the matching NVIDIA headless driver package.","Check that the selected EGL vendor actually supports pbuffers: run eglinfo and confirm a config with EGL_SURFACE_TYPE=EGL_PBUFFER_BIT and EGL_RENDERABLE_TYPE=EGL_OPENGL_ES3_BIT exists.","If using NVIDIA, ensure the EGL vendor library is the one loaded (check /usr/share/glvnd/egl_vendor.d/10_nvidia.json and that the GPU is accessible, e.g. nvidia-smi works in the container).","On a truly GPU-less host, use a software EGL (Mesa llvmpipe) so pbuffer creation succeeds.","If no working EGL stack is available, avoid the GLSL nodes and use equivalent PyTorch-based image nodes instead."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Run before any GLSL node executes, in the same process/env:\nimport ctypes\nEGL = ctypes.CDLL(\"libEGL.so.1\")\nEGL.eglGetDisplay.argtypes = [ctypes.c_void_p]\ndpy = EGL.eglGetDisplay(ctypes.c_void_p(0))\nif not EGL.eglInitialize(dpy, None, None):\n    raise RuntimeError(\"No usable EGL display — GLSL nodes will fail at eglCreatePbufferSurface\")","typeGuard":null,"tryCatchPattern":"try:\n    run_glsl_node()\nexcept RuntimeError as e:\n    if \"eglCreatePbufferSurface\" in str(e):\n        raise RuntimeError(\"GL/EGL driver cannot create offscreen surfaces; fix the EGL stack (install libegl-mesa/libgles, fix NVIDIA EGL vendor) or avoid GLSL nodes\") from e\n    raise","preventionTips":["Install and verify a working EGL + GLES3 stack (eglinfo) before relying on GLSL nodes.","In containers, install libegl1, libegl-mesa0, libgles2, libgles3 explicitly.","For NVIDIA, confirm the headless driver and EGL vendor JSON are present.","Keep GLSL nodes out of GPU-less CI environments."],"tags":["egl","opengl","headless","gpu","driver","glsl"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}