kovidgoyal/kitty · error · RemoteControlErrorWithoutTraceback
The matched tab is not currently visible, screenshots can on
Error message
The matched tab is not currently visible, screenshots can only be taken of visible tabs
What it means
Raised by the screenshot command when a tab match succeeds but the matched tab is not the active tab in its OS window (or its tab manager is gone). Screenshot capture works by compositing what is on screen, so background tabs cannot be captured.
Source
Thrown at kitty/rc/screenshot.py:90
if match:
windows = list(boss.match_windows(match, window))
if not windows:
raise MatchError(match)
w = windows[0]
tab = w.tabref()
tm = tab.tab_manager_ref() if tab is not None else None
if tab is None or tm is None or tm.active_tab is not tab or not w.is_visible_in_layout:
raise RemoteControlErrorWithoutTraceback('The matched window is not currently visible, screenshots can only be taken of visible windows')
os_window_id = w.os_window_id
target_window_id = w.id
elif match_tab:
tabs = list(boss.match_tabs(match_tab))
if not tabs:
raise MatchError(match_tab, 'tabs')
tab = tabs[0]
tm = tab.tab_manager_ref()
if tm is None or tm.active_tab is not tab:
raise RemoteControlErrorWithoutTraceback('The matched tab is not currently visible, screenshots can only be taken of visible tabs')
os_window_id = tab.os_window_id
else:
atm = boss.active_tab_manager
if atm is None:
raise RemoteControlErrorWithoutTraceback('There is no active OS window to screenshot')
os_window_id = atm.os_window_id
include_tab_bar = True
output_path = payload_get('output_path') or ''
responder = self.create_async_responder(payload_get, window)
def callback(cb_os_window_id: int, cb_window_id: int, pixels: bytes, width: int, height: int) -> None:
if not pixels:
responder.send_error('Failed to take screenshot, the OS window may have been closed')
return
try:
png_data = png_from_32bit_rgba_data(pixels, width, height, True)
if output_path:View on GitHub (pinned to 6d5d0c4406)
Solutions
- Activate the tab first: kitten @ focus-tab --match <expr>, then screenshot
- Capture the active tab / OS window instead of matching a background tab
- Verify with kitty @ ls that the matched tab is its parent's active_tab before capturing
Example fix
# before kitten @ screenshot --match-tab title:logs # after kitten @ focus-tab --match title:logs && kitten @ screenshot --match-tab title:logs
Defensive patterns
Strategy: validation
Validate before calling
import json, subprocess
ls = json.loads(subprocess.check_output(['kitten','@','ls']))
entry = find_tab(ls, match_tab)
if not entry['tab'].get('is_active'):
subprocess.run(['kitten','@','focus-tab','--match', match_tab]) Type guard
def is_active_tab(tab: dict) -> bool:
return bool(tab.get('is_active', tab.get('is_focused', False))) Try / catch
try:
capture_tab(match_tab)
except RCError as e:
if 'not currently visible' in str(e):
subprocess.run(['kitten','@','focus-tab','--match', match_tab]); capture_tab(match_tab) Prevention
- Activate the tab before screenshotting it
- Screenshot the active tab or OS window in automated flows
- Re-validate tab ids right before capture
When it happens
Trigger: kitten @ screenshot --match-tab <expr> where the matched tab is a background tab in its OS window, or its tab manager has been destroyed.
Common situations: Automation screenshotting tabs by title/id while another tab is focused; races where the user switches tabs between listing and capturing; stale tab ids after tab rearrangement.
Related errors
- The matched window is not currently visible, screenshots can
- There is no active OS window to screenshot
- Must specify at most one output file
- This should be run as kitten icat
- This should be run as `kitten notify ...`
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/c19257fda8d16f71.
Report an issue: GitHub.