{"record":{"id":"d590d635be301969","repo":"kovidgoyal/kitty","slug":"this-should-be-run-as-kitten-ssh","errorCode":null,"errorMessage":"This should be run as kitten ssh","messagePattern":"This should be run as kitten ssh","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"kittens/ssh/main.py","lineNumber":340,"sourceCode":"    long_text=\"\"\"\nNumber of digits for the generated TOTP codes. Default is 6.\n\"\"\",\n)\n\nopt(\n    'totp_period',\n    '30',\n    option_type='int',\n    long_text=\"\"\"\nTime period in seconds for the TOTP code validity. Default is 30.\n\"\"\",\n)\n\negr()  # }}}\n\n\ndef main(args: list[str]) -> str | None:\n    raise SystemExit('This should be run as kitten ssh')\n\n\nif __name__ == '__main__':\n    main([])\nelif __name__ == '__wrapper_of__':\n    cd = getattr(sys, 'cli_docs')\n    cd['wrapper_of'] = 'ssh'\nelif __name__ == '__conf__':\n    setattr(sys, 'options_definition', definition)\nelif __name__ == '__extra_cli_parsers__':\n    setattr(sys, 'extra_cli_parsers', {'copy': option_text()})\n","sourceCodeStart":322,"sourceCodeEnd":352,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/main.py#L322-L352","documentation":"kitty's ssh kitten main() is a stub that always raises SystemExit('This should be run as kitten ssh'). The actual functionality lives in the wrapper machinery (the '__wrapper_of__' branch shown in the source) that kitty installs when you use the kitten; direct execution only hits the placeholder.","triggerScenarios":"Executing kittens/ssh/main.py directly with python, or importing it and calling main(). The real code paths run only under kitty's runner with __name__ == '__wrapper_of__' or '__run_kitten__'.","commonSituations":"Trying to use kitty's ssh kitten logic in a plain shell by running the file; CI scripts or tests calling main(); developers reading the source and assuming main() is the entrypoint; running inside a non-kitty terminal where kitty isn't on PATH so they resort to the raw file.","solutions":["Run it as `kitten ssh host` from inside kitty (it needs kitty's wrapper to handle asking for passwords/UI).","Ensure the kitty ssh kitten is enabled: kitty.conf should not have `map ctrl+shift+enter` overridden oddly; use `kitten ssh user@host` or map it.","For scripting/tests, call the underlying helpers (e.g. modify_argv_for_launch_with_cwd, utils functions) instead of main().","If you need plain ssh without kitty integration, just run ssh directly rather than this stub."],"exampleFix":"# before\npython kittens/ssh/main.py  # SystemExit: This should be run as kitten ssh\nmain([])                    # same\n\n# after\nkitten ssh user@host","handlingStrategy":"fallback","validationCode":"import shutil, subprocess, sys\n\ndef ssh_via_kitten(host: str) -> int:\n    if shutil.which('kitten') is None or not os.environ.get('KITTY_WINDOW_ID'):\n        return subprocess.call(['ssh', host])  # plain ssh fallback\n    return subprocess.call(['kitten', 'ssh', host])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check KITTY_WINDOW_ID/KITTY_PID env vars before invoking kitten ssh; fall back to plain ssh outside kitty.","Alias ssh to `kitten ssh` only inside kitty sessions.","Don't call kittens/ssh/main.py main() from scripts; use subprocess ['kitten','ssh',...] or plain ssh."],"tags":["kitty","ssh","kitten","system-exit","cli"],"backgroundTag":"must-run-via-parent-runner","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}