kovidgoyal/kitty · error

with error

Error message

with error

What it means

Emitted by kitty's launcher when it cannot read the file given by --cmd-file / the startup file used to reconstruct argv (e.g. via KITTY_CMD_FILE or the wrapper scripts). perror prints the errno (ENOENT, EACCES, EISDIR...). get_argv_from then returns true with an empty result, so kitty typically falls back to defaults or exits soon after.

Source

Thrown at kitty/launcher/cmdline.c:77

    a->buf[a->pos++] = 0;
    return true;
}

bool
get_argv_from(const char *filename, const char *argv0, argv_array *final_ans) {
    (void)get_config_dir;
    if (!filename || !filename[0]) return true;
    size_t src_sz;
    char *src = read_full_file(filename, &src_sz);
    if (!src) {
        if (errno == ENOENT || errno == ENOTDIR) return true;
#ifdef __APPLE__
        int saved = errno;
        os_log_error(OS_LOG_DEFAULT, "Failed to read from %{public}s with error: %{darwin.errno}d", filename, errno);
        errno = saved;
#endif
        fprintf(stderr, "Failed to read from %s ", filename);
        perror("with error");
        return true;
    }
    ShlexState s = {0};
    argv_array ans = {0};
    bool ok = false;
    ans.buf = malloc(src_sz + strlen(argv0) + 64);
    if (!ans.buf) goto oom;
    ans.needs_free = true;
    if (!add_to_argv(&ans, argv0, strlen(argv0))) goto oom;
    if (!alloc_shlex_state(&s, src, src_sz, false)) goto oom;
    bool keep_going = true;
    while (keep_going) {
        ssize_t q = next_word(&s);
        switch (q) {
            case -1: fprintf(stderr, "Failed to parse %s with error: %s\n", filename, s.err); goto end;
            case -2: keep_going = false; break;
            default:
                if (ans.count == 1 && strcmp(s.buf, "kitty") == 0) continue;

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Check that the file passed as the command file exists and is readable at launch time (cat it manually with the same user).
  2. If using a wrapper script, ensure it writes the cmd file synchronously before exec'ing kitty.
  3. Clear stale KITTY_CMD_FILE from the environment.
  4. Re-run the launcher from a terminal to see the errno string appended after 'with error'.
Defensive patterns

Strategy: validation

Validate before calling

test -r "$KITTY_CMD_FILE" && echo ok || echo missing  # check before launching via wrapper

Prevention

When it happens

Trigger: kitty launched by a wrapper that passes a command file which doesn't exist, is a directory, or is unreadable — read()/stat on `filename` failed in get_argv_from before shell-lexing it.

Common situations: Stale KITTY_CMD_FILE left by a crashed wrapper; kitty.desktop or a script referencing a deleted cmd file; permissions changed after sudo/su; file on an unmounted network share.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/f22bd003246b62c5. Report an issue: GitHub.