{"record":{"id":"0b988e6c0fe32c28","repo":"kovidgoyal/kitty","slug":"the-program-a-0-was-not-found","errorCode":null,"errorMessage":"The program: \"' + a[0] + '\" was not found","messagePattern":"The program: \"' \\+ a\\[0\\] \\+ '\" was not found","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"shell-integration/ssh/bootstrap.py","lineNumber":239,"sourceCode":"            env_vars = f.read()\n        apply_env_vars(env_vars)\n        data_dir = os.environ.pop('KITTY_SSH_KITTEN_DATA_DIR')\n        if not os.path.isabs(data_dir):\n            data_dir = os.path.join(HOME, data_dir)\n        data_dir = os.path.abspath(data_dir)\n        shell_integration_dir = os.path.join(data_dir, 'shell-integration')\n        compile_terminfo(tdir + '/home')\n        move(tdir + '/home', HOME)\n        if os.path.exists(tdir + '/root'):\n            move(tdir + '/root', '/')\n\n\ndef exec_with_better_error(*a):\n    try:\n        os.execlp(*a)\n    except OSError as err:\n        if err.errno == errno.ENOENT:\n            raise SystemExit('The program: \"' + a[0] + '\" was not found')\n        raise\n\n\ndef exec_zsh_with_integration():\n    zdotdir = os.environ.get('ZDOTDIR') or ''\n    if not zdotdir:\n        zdotdir = HOME\n        os.environ.pop('KITTY_ORIG_ZDOTDIR', None)  # ensure this is not propagated\n    else:\n        os.environ['KITTY_ORIG_ZDOTDIR'] = zdotdir\n    # dont prevent zsh-newuser-install from running\n    for q in ('.zshrc', '.zshenv', '.zprofile', '.zlogin'):\n        if os.path.exists(os.path.join(zdotdir, q)):\n            os.environ['ZDOTDIR'] = shell_integration_dir + '/zsh'\n            exec_with_better_error(login_shell, os.path.basename(login_shell), '-l')\n    os.environ.pop('KITTY_ORIG_ZDOTDIR', None)  # ensure this is not propagated\n\n","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/shell-integration/ssh/bootstrap.py#L221-L257","documentation":"Raised by exec_with_better_error() in kitty's SSH bootstrap when os.execlp(*a) fails with errno ENOENT, i.e. the program being exec'd (the user's shell such as zsh/fish/bash, or a target command) was not found on the remote PATH. Instead of a bare OSError traceback, the user gets a clear 'The program: X was not found' SystemExit. Any other OSError is re-raised unchanged.","triggerScenarios":"SSH-ing with shell integration when the shell binary named by SHELL (or explicitly requested) doesn't exist on the remote host, e.g. SHELL=/usr/bin/fish on a host where fish isn't installed; exec_zsh/fish/bash_with_integration all funnel through this helper.","commonSituations":"SHELL environment variable on the remote host pointing to a shell that was never installed or was removed; logging into minimal containers/alpine images; SHELL set to a custom path not present in the image; migrating configs between machines with different shells installed.","solutions":["Install the missing shell on the remote host (e.g. `apt install fish`)","Fix the remote SHELL env var to point to an existing shell (edit /etc/passwd entry or set SHELL correctly)","Explicitly select an installed shell: `kitty +kitten ssh --shell-integration=disabled user@host` then `chsh -s /bin/bash`","As a workaround, run a shell that exists: `kitty +kitten ssh user@host bash`"],"exampleFix":"# before\nkitty +kitten ssh myhost\n# SystemExit: The program: \"fish\" was not found\n\n# after\n# on remote host:\nsudo apt install fish   # or: chsh -s /bin/bash","handlingStrategy":"validation","validationCode":"import os, shutil\nshell = os.environ.get('SHELL', '/bin/sh')\nshell_exists = shutil.which(shell) or os.path.exists(shell)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure SHELL on remote hosts points to an installed shell","Install the shell you expect before configuring it as default","SSH with an explicit installed shell as the remote command when bootstrapping new hosts"],"tags":["kitty","ssh","exec","shell-not-found"],"backgroundTag":"shell-executable-not-found","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}