kovidgoyal/kitty · error · KeyError

Unknown value for show_hyperlink_targets: {x!r}

Error message

Unknown value for show_hyperlink_targets: {x!r}

What it means

show_hyperlink_targets raises KeyError when the modifier value is not one of the accepted keys: ctrl, shift, alt/meta, super/cmd. It maps these to modifier names used to reveal hyperlink targets on hover.

Source

Thrown at kitty/options/utils.py:708

def url_prefixes(x: str) -> tuple[str, ...]:
    return tuple(a.lower() for a in x.replace(',', ' ').split())


def show_hyperlink_targets(x: str) -> Literal['never', 'always', 'Ctrl', 'Shift', 'Super', 'Alt']:
    q = x.lower()
    if q in ('never', 'n', 'no', 'false'):
        return 'never'
    if q in ('y', 'yes', 'true', 'always'):
        return 'always'
    if q == 'ctrl':
        return 'Ctrl'
    if q == 'shift':
        return 'Shift'
    if q in ('super', 'cmd'):
        return 'Super'
    if q in ('alt', 'meta'):
        return 'Alt'
    raise KeyError(f'Unknown value for show_hyperlink_targets: {x!r}')


def copy_on_select(raw: str) -> str:
    q = raw.lower()
    # boolean values special cased for backwards compat
    if q in ('y', 'yes', 'true', 'clipboard'):
        return 'clipboard'
    if q in ('n', 'no', 'false', ''):
        return ''
    return raw


def window_size(val: str) -> tuple[int, str]:
    val = val.lower()
    unit = 'cells' if val.endswith('c') else 'px'
    return positive_int(val.rstrip('c')), unit

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use one of: ctrl, shift, alt, meta, super, cmd
  2. Disable via show_hyperlink_targets no / removing the line per docs

Example fix

# before
show_hyperlink_targets hyper
# after
show_hyperlink_targets ctrl
Defensive patterns

Strategy: type-guard

Type guard

def is_hyperlink_mod(x: str) -> bool:
    return x.lower() in {'ctrl','shift','alt','meta','super','cmd'}

Prevention

When it happens

Trigger: show_hyperlink_targets hyper, show_hyperlink_targets mouse, or a typo like 'shft' in kitty.conf.

Common situations: Expecting arbitrary modifier strings or 'none'/'yes' booleans; copy-paste from other terminals' hyperlink options.

Related errors


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