kovidgoyal/kitty · error · ValueError
--hold-after-ssh can only be supplied if --cwd=current or si
Error message
--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied
What it means
In _launch, --hold-after-ssh only makes sense when the window's cwd is derived from an existing window (so kitty knows which ssh child to hold). If opts.cwd is not one of 'current', 'last_reported', 'oldest', a ValueError is raised.
Source
Thrown at kitty/launch.py:726
kw['bias'] = max(-100, min(opts.bias, 100))
if opts.cwd:
if opts.cwd == 'current':
if source_window:
kw['cwd_from'] = CwdRequest(source_window)
elif opts.cwd == 'last_reported':
if source_window:
kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.last_reported)
elif opts.cwd == 'oldest':
if source_window:
kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.oldest)
elif opts.cwd == 'root':
if source_window:
kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.root)
else:
kw['cwd'] = opts.cwd
if opts.hold_after_ssh:
if opts.cwd not in ('current', 'last_reported', 'oldest'):
raise ValueError('--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied')
kw['hold_after_ssh'] = True
if opts.location != 'default':
kw['location'] = opts.location
if opts.copy_colors and source_window:
kw['copy_colors_from'] = source_window
pipe_data: dict[str, Any] = {}
if opts.stdin_source != 'none':
q = str(opts.stdin_source)
if opts.stdin_add_formatting:
if q in (
'@screen',
'@screen_scrollback',
'@alternate',
'@alternate_scrollback',
'@first_cmd_output_on_screen',
'@last_cmd_output',
'@last_visited_cmd_output',View on GitHub (pinned to 6d5d0c4406)
Solutions
- Add --cwd=current (or last_reported/oldest) alongside --hold-after-ssh.
- Remove --hold-after-ssh if you specify an explicit --cwd.
Example fix
# before kitty @ launch --hold-after-ssh --cwd=/tmp # after kitty @ launch --hold-after-ssh --cwd=current
Defensive patterns
Strategy: validation
Validate before calling
HOLD_OK = ('current', 'last_reported', 'oldest')
if opts.hold_after_ssh:
assert opts.cwd in HOLD_OK, '--hold-after-ssh requires --cwd in ' + str(HOLD_OK) Type guard
def launch_opts_consistent(opts) -> bool:
return not opts.hold_after_ssh or opts.cwd in ('current', 'last_reported', 'oldest') Prevention
- Treat --hold-after-ssh and explicit --cwd as mutually exclusive.
- Encode the constraint in your launch-command builder.
When it happens
Trigger: Combining --hold-after-ssh with --cwd=<explicit path>, --cwd=root, or the default cwd resolution, i.e. any value outside the allowed trio.
Common situations: Users copying --hold-after-ssh into a launch command that also sets --cwd=/some/path; kittens/scripts combining flags without checking constraints; version upgrades introducing the new flag.
Related errors
- This should be run as kitten ssh
- Incorrect owner on pwfile: uid={shm.stats.st_uid} gid={shm.s
- Incorrect permissions on pwfile: 0o{mode:03o}
- Incorrect password
- Incorrect request id: {rq_id!r} expecting the KITTY_PID-KITT
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/db841400cd85ffc1.
Report an issue: GitHub.