Comfy-Org/ComfyUI · error · RuntimeError

eglChooseConfig() failed

Error message

eglChooseConfig() failed

What it means

Raised during GLSL renderer initialization when eglChooseConfig returns false or zero configs for the requested attributes: an OpenGL ES 3 renderable, pbuffer-capable config with 8-bit RGBA. The display and API bind succeeded, but no framebuffer configuration on this system matches — usually meaning the driver exposes no ES3-capable surfaceless/pbuffer config (common on bare software rendering setups or incomplete driver installs).

Source

Thrown at comfy_extras/nodes_glsl.py:271

        try:
            self._display, self._egl_major, self._egl_minor = _get_egl_display()

            if not EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API):
                raise RuntimeError("eglBindAPI(EGL_OPENGL_ES_API) failed")

            config = EGL.EGLConfig()
            n_configs = ctypes.c_int32(0)
            if not EGL.eglChooseConfig(
                self._display,
                _egl_attribs(
                    EGL.EGL_RENDERABLE_TYPE, EGL.EGL_OPENGL_ES3_BIT,
                    EGL.EGL_SURFACE_TYPE, EGL.EGL_PBUFFER_BIT,
                    EGL.EGL_RED_SIZE, 8, EGL.EGL_GREEN_SIZE, 8,
                    EGL.EGL_BLUE_SIZE, 8, EGL.EGL_ALPHA_SIZE, 8,
                ),
                ctypes.byref(config), 1, ctypes.byref(n_configs),
            ) or n_configs.value == 0:
                raise RuntimeError("eglChooseConfig() failed")

            self._surface = EGL.eglCreatePbufferSurface(
                self._display, config,
                _egl_attribs(EGL.EGL_WIDTH, 64, EGL.EGL_HEIGHT, 64),
            )
            if not self._surface:
                raise RuntimeError("eglCreatePbufferSurface() failed")

            self._context = EGL.eglCreateContext(
                self._display, config, EGL.EGL_NO_CONTEXT,
                _egl_attribs(EGL.EGL_CONTEXT_CLIENT_VERSION, 3),
            )
            if not self._context:
                raise RuntimeError("eglCreateContext() failed")

            if not EGL.eglMakeCurrent(self._display, self._surface, self._surface, self._context):
                raise RuntimeError("eglMakeCurrent() failed")

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Update Mesa / GPU drivers to a version advertising ES 3.x configs on the platform in use.
  2. In containers/VMs, enable 3D acceleration or pass through a real GPU so full config sets are exposed.
  3. If a display server is available, set DISPLAY so the default platform (with richer configs) is used instead of the surfaceless fallback.
  4. Diagnose with eglinfo listing configs for the same platform to confirm an ES3 pbuffer config exists.

Example fix

# confirm an ES3 + pbuffer config exists on this host
eglinfo -B | grep -A3 'OpenGL ES'  # need ES3 renderable, pbuffer surface configs
# docker: prefer a full GPU runtime image or install matching vendor ICDs
apt-get install -y libegl-mesa0 mesa-utils
Defensive patterns

Strategy: try-catch

Validate before calling

import ctypes
from OpenGL import EGL

def es3_pbuffer_config_exists() -> bool:
    d = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY)
    m, n = ctypes.c_int32(0), ctypes.c_int32(0)
    if not d or not EGL.eglInitialize(d, ctypes.byref(m), ctypes.byref(n)):
        return False
    if not EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API):
        return False
    cfg = EGL.EGLConfig()
    cnt = ctypes.c_int32(0)
    ok = EGL.eglChooseConfig(d, _egl_attribs(
        EGL.EGL_RENDERABLE_TYPE, EGL.EGL_OPENGL_ES3_BIT,
        EGL.EGL_SURFACE_TYPE, EGL.EGL_PBUFFER_BIT,
        EGL.EGL_RED_SIZE, 8, EGL.EGL_GREEN_SIZE, 8,
        EGL.EGL_BLUE_SIZE, 8, EGL.EGL_ALPHA_SIZE, 8),
        ctypes.byref(cfg), 1, ctypes.byref(cnt))
    return bool(ok) and cnt.value > 0

Try / catch

try:
    renderer = GlslRenderer()
except RuntimeError as e:
    if 'eglChooseConfig' in str(e):
        raise RuntimeError('no ES3 pbuffer EGL config; update Mesa/GPU drivers or enable a real GPU') from e
    raise

Prevention

When it happens

Trigger: Initializing the GLSL node on a GPU/driver combo that lacks ES3 pbuffer configs (older Intel/NVIDIA drivers, some VM GPUs, llvmpipe without ES3), or where the chosen EGL platform (surfaceless/ANGLE Vulkan fallback) supports fewer configs than a real display would.

Common situations: Headless fallback platforms (MESA surfaceless) on drivers that do not list pbuffer ES3 configs there; VMs with 3D acceleration disabled; older Mesa versions predating ES3.2; proprietary driver containers missing vendor ICDs.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/516d9fdee321f107. Report an issue: GitHub.