kovidgoyal/kitty · error · ValueError

The value {val} is not a valid choice for undercurl_style

Error message

The value {val} is not a valid choice for undercurl_style

What it means

undercurl_style selects how undercurls (squiggly underlines) are rendered and must be one of thin-sparse, thin-dense, thick-sparse, thick-dense. The parser lowercases and validates against this frozenset.

Source

Thrown at kitty/options/parse.py:1474

    choices_for_terminfo_type = frozenset(('path', 'direct', 'none'))

    def text_composition_strategy(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['text_composition_strategy'] = str(val)

    def text_fg_override_threshold(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['text_fg_override_threshold'] = text_fg_override_threshold(val)

    def touch_scroll_multiplier(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['touch_scroll_multiplier'] = float(val)

    def transparent_background_colors(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['transparent_background_colors'] = transparent_background_colors(val)

    def undercurl_style(self, val: str, ans: dict[str, typing.Any]) -> None:
        val = val.lower()
        if val not in self.choices_for_undercurl_style:
            raise ValueError(f"The value {val} is not a valid choice for undercurl_style")
        ans["undercurl_style"] = val

    choices_for_undercurl_style = frozenset(('thin-sparse', 'thin-dense', 'thick-sparse', 'thick-dense'))

    def underline_exclusion(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['underline_exclusion'] = underline_exclusion(val)

    def underline_hyperlinks(self, val: str, ans: dict[str, typing.Any]) -> None:
        val = val.lower()
        if val not in self.choices_for_underline_hyperlinks:
            raise ValueError(f"The value {val} is not a valid choice for underline_hyperlinks")
        ans["underline_hyperlinks"] = val

    choices_for_underline_hyperlinks = frozenset(('hover', 'always', 'never'))

    def update_check_interval(self, val: str, ans: dict[str, typing.Any]) -> None:
        ans['update_check_interval'] = float(val)

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use a full compound value: thin-sparse, thin-dense, thick-sparse, or thick-dense
  2. Ensure the two words are joined by a hyphen with no spaces
  3. Fix partial values like 'thick' by choosing sparse or dense

Example fix

# before
undercurl_style thick
# after
undercurl_style thick-sparse
Defensive patterns

Strategy: validation

Validate before calling

value = value.lower()
if value not in ('thin-sparse','thin-dense','thick-sparse','thick-dense'):
    raise SystemExit(f'bad undercurl_style: {value}')

Type guard

def is_undercurl_style(v: str) -> bool:
    return v.lower() in ('thin-sparse','thin-dense','thick-sparse','thick-dense')

Prevention

When it happens

Trigger: Setting `undercurl_style thick`, `undercurl_style dense`, or using a space instead of the hyphen (`thin sparse`) in kitty.conf.

Common situations: Specifying only half the compound value; using a space or underscore instead of hyphen; typos from manually editing spell-check styling configs.

Related errors


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