kovidgoyal/kitty · warning

Could not move child process into a systemd scope:

Error message

Could not move child process into a systemd scope: 

What it means

kitty tries to place each spawned child into its own systemd scope (so systemd doesn't kill or misattribute it); if the D-Bus/systemd call fails with OSError it logs this and continues normally.

Source

Thrown at kitty/child.py:530

        )
        os.close(slave)
        self.pid = pid
        self.child_fd = master
        if stdin is not None:
            os.close(stdin_read_fd)
            fast_data_types.thread_write(stdin_write_fd, stdin)
        os.close(ready_read_fd)
        self.terminal_ready_fd = ready_write_fd
        if self.child_fd is not None:
            os.set_blocking(self.child_fd, False)
        if not is_macos:
            ppid = getpid()
            try:
                fast_data_types.systemd_move_pid_into_new_scope(pid, f'kitty-{ppid}-{self.id}.scope', f'kitty child process: {pid} launched by: {ppid}')
            except NotImplementedError:
                pass
            except OSError as err:
                log_error('Could not move child process into a systemd scope: ' + str(err))
        return pid

    def __del__(self) -> None:
        fd = getattr(self, 'terminal_ready_fd', -1)
        if fd > -1:
            os.close(fd)
        self.terminal_ready_fd = -1

    def mark_terminal_ready(self) -> None:
        os.close(self.terminal_ready_fd)
        self.terminal_ready_fd = -1

    def cmdline_of_pid(self, pid: int) -> list[str]:
        try:
            ans = cmdline_of_pid(pid)
        except Exception:
            ans = []
        if pid == self.pid and (not ans):

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Ignore — cosmetic; the child still runs, just outside its own scope
  2. Ensure a proper systemd user session (loginctl show-user $USER)
  3. In containers, no action is possible/needed
Defensive patterns

Strategy: fallback

Validate before calling

import subprocess
has_systemd = subprocess.run(['systemctl','--user','is-system-running'], capture_output=True).returncode == 0

Prevention

When it happens

Trigger: `systemd_move_pid_into_new_scope` fails: no systemd user session, older systemd without the API, cgroup filesystem read-only (containers), or dbus-broker mismatch. NotImplementedError is silently ignored; only OSError is logged.

Common situations: Running kitty inside Docker/other containers, on non-systemd init systems, or over odd session setups where the user manager is unavailable.

Related errors


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