{"record":{"id":"263da73f36b8b461","repo":"kovidgoyal/kitty","slug":"glfw-error-d-s","errorCode":null,"errorMessage":"[glfw error %d]: %s","messagePattern":"\\[glfw error (.+?)\\]: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kitty/glfw.c","lineNumber":2378,"sourceCode":"    if (w->handle) {\n#ifdef __APPLE__\n        if (!also_raise) cocoa_focus_window(glfwGetCocoaWindow(w->handle));\n        else glfwFocusWindow(w->handle);\n        (void)activation_token;\n#else\n        if (global_state.is_wayland && activation_token && activation_token[0] && also_raise) {\n            glfwWaylandActivateWindow(w->handle, activation_token);\n            return;\n        }\n        glfwFocusWindow(w->handle);\n#endif\n    }\n}\n\n// Global functions {{{\nstatic void\nerror_callback(int error, const char *description) {\n    log_error(\"[glfw error %d]: %s\", error, description);\n}\n\n\n#ifndef __APPLE__\nstatic PyObject *dbus_notification_callback = NULL;\n\nstatic PyObject *\ndbus_set_notification_callback(PyObject *self UNUSED, PyObject *callback) {\n    Py_CLEAR(dbus_notification_callback);\n    if (callback && callback != Py_None) {\n        dbus_notification_callback = callback;\n        Py_INCREF(callback);\n        GLFWDBUSNotificationData d = {.timeout = -99999, .urgency = 255};\n        if (!glfwDBusUserNotify) {\n            PyErr_SetString(PyExc_RuntimeError, \"Failed to load glfwDBusUserNotify, did you call glfw_init?\");\n            return NULL;\n        }\n        glfwDBusUserNotify(&d, NULL, NULL);","sourceCodeStart":2360,"sourceCodeEnd":2396,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/glfw.c#L2360-L2396","documentation":"This is kitty's GLFW error callback, invoked by GLFW whenever an internal GLFW error occurs (window creation failure, context creation, monitor, EGL/WGL/X11 errors). The numeric code and GLFW-provided description are logged; the message itself is a wrapper, so the real problem is the GLFW error code in the output (e.g. 65543 ' EGL: Failed to create context').","triggerScenarios":"Any GLFW API call failing: glfwCreateWindow without a valid graphics context, EGL context creation failure on broken GPU drivers, requesting a GL version unsupported by the driver, monitor/video-mode queries on headless systems, or invalid window hints.","commonSituations":"Running kitty over SSH/X forwarding with no GLX; broken or missing GPU drivers (EGL initialization failed, error 65543); headless CI containers trying to open a kitty window; nvidia driver mismatches; running on X11 without libEGL properly installed.","solutions":["Decode the numeric code against GLFW error constants (0x0001000X platform errors, 0x0003000X API-unavailable/format-unavailable) and address the underlying platform issue","Verify a GPU/graphics stack is present: install libEGL/libGL and proper drivers (e.g. mesa, nvidia)","For headless/SSH use, run kitty with a software renderer or avoid window creation; use kitty +kitten doc etc. instead","Set GLFW_DEBUG for more verbose output and check the session type (echo $XDG_SESSION_TYPE) matches the platform kitty is using"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// C: install your own callback before GLFW init to capture code+description\nglfwSetErrorCallback(my_error_callback); // my_error_callback logs error code and description, and can map 0x00010006 (PLATFORM_ERROR) to remediation steps","typeGuard":null,"tryCatchPattern":"if (glfwInit() == GLFW_FALSE) { /* the previously installed error callback already captured the code/description; branch on it */ }","preventionTips":["Always install an error callback before glfwInit so real causes are not lost","On headless/SSH, avoid APIs that create windows","Keep GPU drivers and EGL libraries consistent"],"tags":["kitty","glfw","opengl","egl","driver","window-creation"],"backgroundTag":"glfw-error-callback","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}