{"record":{"id":"494c40c65416c784","repo":"kovidgoyal/kitty","slug":"failed-to-compile-the-terminfo-database","errorCode":null,"errorMessage":"Failed to compile the terminfo database","messagePattern":"Failed to compile the terminfo database","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"shell-integration/ssh/bootstrap.py","lineNumber":168,"sourceCode":"        try:\n            os.makedirs(os.path.dirname(q))\n        except EnvironmentError as e:\n            if e.errno != errno.EEXIST:\n                raise\n        os.symlink('../x/xterm-kitty', q)\n    if os.path.exists('/usr/share/misc/terminfo.cdb'):\n        # NetBSD requires this\n        os.symlink('../../.terminfo.cdb', os.path.join(base, tname, 'x', 'xterm-kitty'))\n        tname += '.cdb'\n    os.environ['TERMINFO'] = os.path.join(HOME, tname)\n    p = subprocess.Popen(\n        [tic, '-x', '-o', os.path.join(base, tname), os.path.join(base, '.terminfo', 'kitty.terminfo')], stdout=subprocess.PIPE, stderr=subprocess.STDOUT\n    )\n    output = p.stdout.read()\n    rc = p.wait()\n    if rc != 0:\n        getattr(sys.stderr, 'buffer', sys.stderr).write(output)\n        raise SystemExit('Failed to compile the terminfo database')\n\n\ndef iter_base64_data(f):\n    global leading_data\n    started = 0\n    while True:\n        line = f.readline().rstrip()\n        if started == 0:\n            if line == b'KITTY_DATA_START':\n                started = 1\n            else:\n                leading_data += line\n        elif started == 1:\n            if line == b'OK':\n                started = 2\n            else:\n                raise SystemExit(line.decode('utf-8', 'replace').rstrip())\n        else:","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/shell-integration/ssh/bootstrap.py#L150-L186","documentation":"Raised by compile_terminfo() in kitty's SSH bootstrap script when the `tic` terminfo compiler exits non-zero while compiling kitty.terminfo into a compiled terminfo database. The script captures tic's stdout/stderr, writes it to stderr for diagnosis, then aborts with SystemExit. tic is part of ncurses and must be present on the remote host during SSH shell integration bootstrap.","triggerScenarios":"SSH-ing to a host where `tic -x -o ... kitty.terminfo` fails: missing tic binary path issues produce a different error, but a non-zero tic exit (malformed terminfo source, unsupported capabilities, read-only -o output dir, old tic without -x support) triggers this.","commonSituations":"Remote hosts with very old ncurses/tic that reject kitty's extended capabilities; HOME or the output base dir not writable so tic can't write the database; a truncated .terminfo file after a partial transfer; odd TERM settings interfering.","solutions":["Check the tic output printed just above the error — it names the exact failing capability or line","Upgrade ncurses/tic on the remote host (e.g. `apt install ncurses-base ncurses-bin` or the distro equivalent)","Ensure the output base directory is writable; set HOME to a writable dir before kitty ssh runs","If tic is fundamentally broken on that host, copy a precompiled terminfo from a machine with matching ncurses instead of compiling"],"exampleFix":"# before\nkitty +kitten ssh oldhost  # SystemExit: Failed to compile the terminfo database\n\n# after\n# on remote host:\nsudo apt install ncurses-bin\n# verify: tic -x -o /tmp/terminfo /usr/share/terminfo/x/kitty.terminfo && echo ok","handlingStrategy":"fallback","validationCode":"import shutil\n\nhas_tic = shutil.which('tic') is not None\nwritable_home = os.access(os.path.expanduser('~'), os.W_OK)","typeGuard":null,"tryCatchPattern":"try:\n    compile_terminfo(...)\nexcept SystemExit as e:\n    if 'Failed to compile the terminfo' in str(e):\n        # fall back to TERM=xterm or copy a precompiled terminfo\n        ...","preventionTips":["Keep ncurses/tic reasonably up to date on hosts you SSH into","Ensure HOME on the remote host is writable","Pre-seed a compiled kitty terminfo in ~/.terminfo instead of compiling per session"],"tags":["kitty","ssh","terminfo","ncurses"],"backgroundTag":"terminfo-compile-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}