kovidgoyal/kitty · warning · OSError

Failed to start window drag: {e}

Error message

Failed to start window drag: {e}

What it means

Starting a native window drag (dragging a kitty window out of the OS window) failed with an OSError from the platform backend; kitty resets the window-drag state.

Source

Thrown at kitty/tabs.py:2037

        min_w = opts.window_title_bar_min_windows
        for tm in boss.all_tab_managers:
            tm.mark_tab_bar_dirty()
            for t in tm:
                visible = sum(1 for _ in t.windows.iter_all_layoutable_groups(only_visible=True))
                if not (min_w > 0 and visible >= min_w):
                    t.force_show_title_bars = True
                    t.relayout()
        title = str(w.title or '')
        fg = color_as_int(opts.window_title_bar_active_foreground or opts.active_tab_foreground)
        bg = color_as_int(opts.window_title_bar_active_background or opts.active_tab_background)
        title_pixels, width = draw_single_line_of_text(self.os_window_id, title, 0xFF000000 | fg, 0xFF000000 | bg, width)
        title_height = len(title_pixels) // (width * 4)
        thumbnails = ((title_pixels + pixels, width, title_height + height),)
        drag_data = {f'application/net.kovidgoyal.kitty-window-{os.getpid()}': str(window_id).encode()}
        try:
            start_drag_with_data(self.os_window_id, drag_data, thumbnails)
        except OSError as e:
            log_error(f'Failed to start window drag: {e}')
            set_window_being_dragged()
            self._clear_force_show_title_bars()

    def _set_drag_target_tab(self, tab_id: int) -> None:
        if self.window_drag_target_tab_id == tab_id:
            return
        self.window_drag_target_tab_id = tab_id
        self.mark_tab_bar_dirty()

    def _clear_force_show_title_bars(self) -> None:
        boss = get_boss()
        for tm in boss.all_tab_managers:
            tm._set_drag_target_window(0)
            tm._set_drag_target_tab(0)
            for tab in tm:
                if tab.force_show_title_bars:
                    tab.force_show_title_bars = False
                    tab.relayout()

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use kitten @new-window / launch --copy-env or :detach-window instead of native drag
  2. Update compositor and kitty; check kitty release notes for drag fixes
  3. Report with the OSError details if reproducible
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: start_drag_with_data raises OSError in the window-drag branch in tabs.py, e.g. compositor rejecting the net.kitty-window mime drag.

Common situations: Same class of issue as tab drags: Wayland compositors with limited drag-and-drop, unusual GPU/driver setups, or nested kitty instances.

Related errors


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