{"record":{"id":"d920bcf4f64bb944","repo":"kovidgoyal/kitty","slug":"specified-password-is-too-long","errorCode":null,"errorMessage":"Specified password is too long","messagePattern":"Specified password is too long","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"kitty/remote_control.py","lineNumber":518,"sourceCode":"                try:\n                    tty_fd = os.open(os.ctermid(), os.O_RDONLY | os.O_CLOEXEC)\n                except OSError:\n                    pass\n                else:\n                    with open(tty_fd, closefd=True):\n                        os.dup2(tty_fd, sys.stdin.fileno())\n        else:\n            try:\n                with open(resolve_custom_file(opts.password_file)) as f:\n                    ans = f.read().rstrip()\n            except OSError:\n                pass\n    if not ans and opts.password_env:\n        ans = os.environ.get(opts.password_env, '')\n    if not ans and opts.use_password == 'always':\n        raise SystemExit('No password was found')\n    if ans and len(ans) > 1024:\n        raise SystemExit('Specified password is too long')\n    return ans\n\n\ndef get_pubkey() -> tuple[str, bytes]:\n    raw = os.environ.get('KITTY_PUBLIC_KEY', '')\n    if not raw:\n        raise SystemExit('Password usage requested but KITTY_PUBLIC_KEY environment variable is not available')\n    version, pubkey = raw.split(':', 1)\n    if version != RC_ENCRYPTION_PROTOCOL_VERSION:\n        raise SystemExit('KITTY_PUBLIC_KEY has unknown version, if you are running on a remote system, update kitty on this system')\n    from base64 import b85decode\n\n    return version, b85decode(pubkey)\n","sourceCodeStart":500,"sourceCodeEnd":532,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/remote_control.py#L500-L532","documentation":"Remote-control passwords are capped at 1024 bytes; a longer password causes SystemExit 'Specified password is too long'.","triggerScenarios":"Supplying a password longer than 1024 characters via env var or file with password usage enabled.","commonSituations":"Pasting a key/token instead of a short password.","solutions":["Use a password of 1024 bytes or fewer","If a long secret is needed, use public-key encryption (KITTY_PUBLIC_KEY) instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert 0 < len(password) <= 1024","typeGuard":"def password_ok(p: str) -> bool: return 0 < len(p) <= 1024","tryCatchPattern":null,"preventionTips":["Use short shared secrets, not long tokens"],"tags":["kitty","remote-control","validation"],"backgroundTag":"credential-too-long","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}