kovidgoyal/kitty · error

[glfw error %d]: %s

Error message

[glfw error %d]: %s

What it means

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').

Source

Thrown at kitty/glfw.c:2378

    if (w->handle) {
#ifdef __APPLE__
        if (!also_raise) cocoa_focus_window(glfwGetCocoaWindow(w->handle));
        else glfwFocusWindow(w->handle);
        (void)activation_token;
#else
        if (global_state.is_wayland && activation_token && activation_token[0] && also_raise) {
            glfwWaylandActivateWindow(w->handle, activation_token);
            return;
        }
        glfwFocusWindow(w->handle);
#endif
    }
}

// Global functions {{{
static void
error_callback(int error, const char *description) {
    log_error("[glfw error %d]: %s", error, description);
}


#ifndef __APPLE__
static PyObject *dbus_notification_callback = NULL;

static PyObject *
dbus_set_notification_callback(PyObject *self UNUSED, PyObject *callback) {
    Py_CLEAR(dbus_notification_callback);
    if (callback && callback != Py_None) {
        dbus_notification_callback = callback;
        Py_INCREF(callback);
        GLFWDBUSNotificationData d = {.timeout = -99999, .urgency = 255};
        if (!glfwDBusUserNotify) {
            PyErr_SetString(PyExc_RuntimeError, "Failed to load glfwDBusUserNotify, did you call glfw_init?");
            return NULL;
        }
        glfwDBusUserNotify(&d, NULL, NULL);

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Decode the numeric code against GLFW error constants (0x0001000X platform errors, 0x0003000X API-unavailable/format-unavailable) and address the underlying platform issue
  2. Verify a GPU/graphics stack is present: install libEGL/libGL and proper drivers (e.g. mesa, nvidia)
  3. For headless/SSH use, run kitty with a software renderer or avoid window creation; use kitty +kitten doc etc. instead
  4. Set GLFW_DEBUG for more verbose output and check the session type (echo $XDG_SESSION_TYPE) matches the platform kitty is using
Defensive patterns

Strategy: fallback

Validate before calling

// C: install your own callback before GLFW init to capture code+description
glfwSetErrorCallback(my_error_callback); // my_error_callback logs error code and description, and can map 0x00010006 (PLATFORM_ERROR) to remediation steps

Try / catch

if (glfwInit() == GLFW_FALSE) { /* the previously installed error callback already captured the code/description; branch on it */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/263da73f36b8b461. Report an issue: GitHub.