kovidgoyal/kitty · warning

Too many hyperlinks, discarding hyperlink: %s

Error message

Too many hyperlinks, discarding hyperlink: %s

What it means

Even after discarding scrollback hyperlinks the pool is completely full (>= HYPERLINK_MAX_NUMBER), so the new hyperlink gets id 0 and is not clickable. The offending URI is printed.

Source

Thrown at kitty/hyperlink.c:152

hyperlink_id_type
get_id_for_hyperlink(Screen *screen, const char *id, const char *url) {
    if (!url) return 0;
    HyperLinkPool *pool = (HyperLinkPool *)screen->hyperlink_pool;
    static char key[MAX_KEY_LEN] = {0};
    int keylen = snprintf(key, MAX_KEY_LEN - 1, "%.*s:%s", MAX_ID_LEN, id ? id : "", url);
    if (keylen < 0) keylen = strlen(key);
    else keylen = MIN(keylen, MAX_KEY_LEN - 2); // snprintf returns how many chars it would have written in case of truncation
    key[keylen] = 0;
    hyperlink_map_itr itr = vt_get(&pool->map, key);
    if (!vt_is_end(itr)) return itr.data->val;
    if (pool->array.count >= HYPERLINK_MAX_NUMBER - 1) {
        screen_garbage_collect_hyperlink_pool(screen);
        if (pool->array.count >= HYPERLINK_MAX_NUMBER - 128) {
            log_error("Too many hyperlinks, discarding hyperlinks in scrollback");
            _screen_garbage_collect_hyperlink_pool(screen, false);
            if (pool->array.count >= HYPERLINK_MAX_NUMBER) {
                log_error("Too many hyperlinks, discarding hyperlink: %s", key);
                return 0;
            }
        }
    }
    if (!pool->array.count) pool->array.count = 1; // First id must be 1
    ensure_space_for(&(pool->array), items, hyperlink, pool->array.count + 1, capacity, 256, false);
    hyperlink_id_type new_id = pool->array.count++;
    pool->array.items[new_id] = dupstr(key, keylen);
    if (vt_is_end(vt_insert(&pool->map, pool->array.items[new_id], new_id))) fatal("Out of memory");
    // If there have been a lot of hyperlink adds do a garbage collect so as
    // not to leak too much memory over unused hyperlinks
    if (++pool->adds_since_last_gc > 8192) screen_garbage_collect_hyperlink_pool(screen);
    return new_id;
}

const char *
get_hyperlink_for_id(const HYPERLINK_POOL_HANDLE handle, hyperlink_id_type id, bool only_url) {
    HyperLinkPool *pool = (HyperLinkPool *)handle;

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Reduce simultaneously displayed unique links in the application
  2. Clear the screen/scrollback to release hyperlink ids
  3. Update kitty
  4. File an upstream issue against the app emitting the flood of links
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Thousands of simultaneously live (on-screen) unique OSC 8 hyperlinks exhausting the pool so no id can be allocated.

Common situations: Applications rendering huge linkified documents with massive numbers of distinct active links.

Related errors


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