{"record":{"id":"0857249aadc115ac","repo":"kovidgoyal/kitty","slug":"pipe-to-kitten-was-broken-while-sending-data-to-it","errorCode":null,"errorMessage":"Pipe to kitten was broken while sending data to it","messagePattern":"Pipe to kitten was broken while sending data to it","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"warning","filePath":"kittens/choose_fonts/backend.py","lineNumber":59,"sourceCode":"        except Exception:\n            return False\n        try:\n            sys.stdout = open(fd, 'w', closefd=False)\n            return True\n        except OSError:\n            return False\n    return False\n\n\ndef send_to_kitten(x: Any) -> None:\n    f = sys.__stdout__\n    assert f is not None\n    try:\n        f.buffer.write(json.dumps(x).encode())\n        f.buffer.write(b'\\n')\n        f.buffer.flush()\n    except BrokenPipeError:\n        raise SystemExit('Pipe to kitten was broken while sending data to it')\n\n\nclass TextStyle(TypedDict):\n    font_size: float\n    dpi_x: float\n    dpi_y: float\n    foreground: str\n    background: str\n\n\nOptNames = Literal['font_family', 'bold_font', 'italic_font', 'bold_italic_font']\nFamilyKey = tuple[OptNames, ...]\n\n\ndef opts_from_cmd(cmd: dict[str, Any]) -> tuple[Options, FamilyKey, float, float]:\n    opts = Options()\n    ts: TextStyle = cmd['text_style']\n    opts.font_size = ts['font_size']","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/choose_fonts/backend.py#L41-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"Minimal containers (no libsystemd installed), musl-based distros, NixOS environment mismatch, or a broken ldconfig cache after a partial upgrade.","solutions":["Install libsystemd: apt install libsystemd0 / dnf install systemd-libs / pacman -S systemd-libs.","Run ldconfig and verify: ldconfig -p | grep systemd.","Check ldd on kitty binary for conflicting library paths (LD_LIBRARY_PATH, conda envs).","If systemd features are unwanted, ignore - kitty works fine without it."],"exampleFix":"# before (Debian container with no systemd libs)\n# log: Failed to load libsystemd.so.0 ...\n# after\napt-get update && apt-get install -y libsystemd0","handlingStrategy":"fallback","validationCode":"# verify the library is loadable before relying on systemd features\nldconfig -p | grep libsystemd","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install systemd-libs/libsystemd0 packages in minimal environments.","Avoid LD_LIBRARY_PATH overrides that shadow system libs."],"tags":["kitty","systemd","dlopen","shared-library","linux"],"backgroundTag":"shared-library-load-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}