{"record":{"id":"db841400cd85ffc1","repo":"kovidgoyal/kitty","slug":"hold-after-ssh-can-only-be-supplied-if-cwd-cur","errorCode":null,"errorMessage":"--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied","messagePattern":"--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/launch.py","lineNumber":726,"sourceCode":"        kw['bias'] = max(-100, min(opts.bias, 100))\n    if opts.cwd:\n        if opts.cwd == 'current':\n            if source_window:\n                kw['cwd_from'] = CwdRequest(source_window)\n        elif opts.cwd == 'last_reported':\n            if source_window:\n                kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.last_reported)\n        elif opts.cwd == 'oldest':\n            if source_window:\n                kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.oldest)\n        elif opts.cwd == 'root':\n            if source_window:\n                kw['cwd_from'] = CwdRequest(source_window, CwdRequestType.root)\n        else:\n            kw['cwd'] = opts.cwd\n    if opts.hold_after_ssh:\n        if opts.cwd not in ('current', 'last_reported', 'oldest'):\n            raise ValueError('--hold-after-ssh can only be supplied if --cwd=current or similar is also supplied')\n        kw['hold_after_ssh'] = True\n\n    if opts.location != 'default':\n        kw['location'] = opts.location\n    if opts.copy_colors and source_window:\n        kw['copy_colors_from'] = source_window\n    pipe_data: dict[str, Any] = {}\n    if opts.stdin_source != 'none':\n        q = str(opts.stdin_source)\n        if opts.stdin_add_formatting:\n            if q in (\n                '@screen',\n                '@screen_scrollback',\n                '@alternate',\n                '@alternate_scrollback',\n                '@first_cmd_output_on_screen',\n                '@last_cmd_output',\n                '@last_visited_cmd_output',","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/launch.py#L708-L744","documentation":"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.","triggerScenarios":"Combining --hold-after-ssh with --cwd=<explicit path>, --cwd=root, or the default cwd resolution, i.e. any value outside the allowed trio.","commonSituations":"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.","solutions":["Add --cwd=current (or last_reported/oldest) alongside --hold-after-ssh.","Remove --hold-after-ssh if you specify an explicit --cwd."],"exampleFix":"# before\nkitty @ launch --hold-after-ssh --cwd=/tmp\n# after\nkitty @ launch --hold-after-ssh --cwd=current","handlingStrategy":"validation","validationCode":"HOLD_OK = ('current', 'last_reported', 'oldest')\nif opts.hold_after_ssh:\n    assert opts.cwd in HOLD_OK, '--hold-after-ssh requires --cwd in ' + str(HOLD_OK)","typeGuard":"def launch_opts_consistent(opts) -> bool:\n    return not opts.hold_after_ssh or opts.cwd in ('current', 'last_reported', 'oldest')","tryCatchPattern":null,"preventionTips":["Treat --hold-after-ssh and explicit --cwd as mutually exclusive.","Encode the constraint in your launch-command builder."],"tags":["kitty","launch","ssh","option-constraint"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}