{"record":{"id":"f7dc7dd082d4971c","repo":"Comfy-Org/ComfyUI","slug":"failed-to-initialize-egl-display-no-display-serve","errorCode":null,"errorMessage":"Failed to initialize EGL display.\nNo display server and no headless EGL platform available.\nTried:\n{details}\nEnsure GPU drivers are installed or set DISPLAY for a virtual framebuffer.","messagePattern":"Failed to initialize EGL display\\.\nNo display server and no headless EGL platform available\\.\nTried:\n(.+?)\nEnsure GPU drivers are installed or set DISPLAY for a virtual framebuffer\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"comfy_extras/nodes_glsl.py","lineNumber":189,"sourceCode":"    ]\n\n    for name, platform, native_display, attribs in headless_strategies:\n        display = _get_egl_platform_display_ext(platform, native_display, attribs)\n        if not display:\n            failures.append(f\"{name}: eglGetPlatformDisplayEXT returned no display\")\n            continue\n        major, minor = ctypes.c_int32(0), ctypes.c_int32(0)\n        try:\n            if EGL.eglInitialize(display, ctypes.byref(major), ctypes.byref(minor)):\n                logger.info(f\"Using EGL {name} platform (headless)\")\n                return display, major.value, minor.value\n            failures.append(f\"{name}: eglInitialize returned false\")\n        except Exception as e:\n            failures.append(f\"{name}: {e}\")\n            continue\n\n    details = \"\\n\".join(f\"  - {f}\" for f in failures)\n    raise RuntimeError(\n        \"Failed to initialize EGL display.\\n\"\n        \"No display server and no headless EGL platform available.\\n\"\n        f\"Tried:\\n{details}\\n\"\n        \"Ensure GPU drivers are installed or set DISPLAY for a virtual framebuffer.\"\n    )\n\n\ndef _gl_str(name):\n    \"\"\"Get an OpenGL string parameter.\"\"\"\n    v = gl.glGetString(name)\n    if not v:\n        return \"Unknown\"\n    if isinstance(v, bytes):\n        return v.decode(errors=\"replace\")\n    return ctypes.string_at(v).decode(errors=\"replace\")\n\n\ndef _detect_output_count(source: str) -> int:","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_glsl.py#L171-L207","documentation":"Raised by _get_egl_display in the GLSL node after every display strategy failed: the default EGL display (X11/Wayland), the MESA surfaceless platform, and the ANGLE Vulkan platform all either returned no display or failed eglInitialize. The message lists per-strategy failure details. This is an environment problem — the machine has no usable EGL implementation for GPU-accelerated OpenGL ES, which the GLSL rendering node requires.","triggerScenarios":"Running the GLSL node on a headless server/container without GPU drivers or without libEGL/Mesa installed; a container missing /usr/lib/x86_64-linux-gnu/libEGL and the surfaceless platform; a host with broken driver installation where eglInitialize fails on every platform.","commonSituations":"Docker images without mesa/EGL packages (e.g., slim CUDA images); headless cloud GPU instances with display-less driver installs; NVIDIA driver misconfiguration (nvidia-egl not installed, or container lacks the EGL ICD JSONs); SSH sessions without DISPLAY where surfaceless is unavailable.","solutions":["Install EGL/GLES runtime packages: mesa-utils, libegl1, libgles2, and for NVIDIA the nvidia EGL ICD files (libnvidia-egl-wayland / nvidia egl-gbm vendor JSONs in /usr/share/glvnd/egl_vendor.d).","In containers, ensure the NVIDIA container toolkit exposes EGL libraries and the 10_nvidia.json ICD.","If an X server exists but DISPLAY is unset, export DISPLAY=:0 (or run under xvfb-run) so the default display strategy works.","Verify with eglinfo that a platform initializes before rerunning the node."],"exampleFix":"# docker: add EGL/GLES runtime before running GLSL nodes\napt-get install -y libegl1 libgles2 libglvnd0 mesa-utils\n# verify a headless platform initializes\neglinfo -B","handlingStrategy":"fallback","validationCode":"import ctypes\nfrom OpenGL import EGL\n\ndef egl_available() -> bool:\n    d = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY)\n    if not d:\n        return False\n    m, n = ctypes.c_int32(0), ctypes.c_int32(0)\n    return bool(EGL.eglInitialize(d, ctypes.byref(m), ctypes.byref(n)))","typeGuard":null,"tryCatchPattern":"try:\n    renderer = GlslRenderer()\nexcept RuntimeError as e:\n    if 'Failed to initialize EGL' in str(e):\n        raise RuntimeError('GLSL nodes need a working EGL stack; install GPU drivers / set DISPLAY') from e\n    raise","preventionTips":["Provision headless hosts with Mesa EGL + GLES packages and vendor ICD JSONs.","In containers use the NVIDIA container toolkit so EGL libraries and ICDs are injected.","Set DISPLAY or run under xvfb when an X server exists.","Smoke-test with eglinfo -B before relying on GLSL nodes."],"tags":["egl","opengl","gpu","headless","environment"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}