kovidgoyal/kitty · warning · SystemExit

Pipe to kitten was broken while sending data to it

Error message

Pipe to kitten was broken while sending data to it

What it means

kitty could not dlopen any of its candidate libsystemd shared libraries (kitty/systemd.c:74). kitty tries a list of library names; if all fail it logs the first name plus dlerror(). Systemd notification/dbus features are then disabled.

Source

Thrown at kittens/choose_fonts/backend.py:59

        except Exception:
            return False
        try:
            sys.stdout = open(fd, 'w', closefd=False)
            return True
        except OSError:
            return False
    return False


def send_to_kitten(x: Any) -> None:
    f = sys.__stdout__
    assert f is not None
    try:
        f.buffer.write(json.dumps(x).encode())
        f.buffer.write(b'\n')
        f.buffer.flush()
    except BrokenPipeError:
        raise SystemExit('Pipe to kitten was broken while sending data to it')


class TextStyle(TypedDict):
    font_size: float
    dpi_x: float
    dpi_y: float
    foreground: str
    background: str


OptNames = Literal['font_family', 'bold_font', 'italic_font', 'bold_italic_font']
FamilyKey = tuple[OptNames, ...]


def opts_from_cmd(cmd: dict[str, Any]) -> tuple[Options, FamilyKey, float, float]:
    opts = Options()
    ts: TextStyle = cmd['text_style']
    opts.font_size = ts['font_size']

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Install libsystemd: apt install libsystemd0 / dnf install systemd-libs / pacman -S systemd-libs.
  2. Run ldconfig and verify: ldconfig -p | grep systemd.
  3. Check ldd on kitty binary for conflicting library paths (LD_LIBRARY_PATH, conda envs).
  4. If systemd features are unwanted, ignore - kitty works fine without it.

Example fix

# before (Debian container with no systemd libs)
# log: Failed to load libsystemd.so.0 ...
# after
apt-get update && apt-get install -y libsystemd0
Defensive patterns

Strategy: fallback

Validate before calling

# verify the library is loadable before relying on systemd features
ldconfig -p | grep libsystemd

Prevention

When it happens

Trigger: kitty startup on Linux when neither libsystemd.so nor the versioned alternatives (libsystemd.so.0 etc.) can be dlopened - missing package, wrong architecture, or LD_LIBRARY_PATH shadowing.

Common situations: Minimal containers (no libsystemd installed), musl-based distros, NixOS environment mismatch, or a broken ldconfig cache after a partial upgrade.

Related errors


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