kovidgoyal/kitty · error · ValueError

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

Error message

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

What it means

tab_bar_align controls horizontal alignment of the tab bar and accepts start, center, end, left, right (logical start/end and physical left/right aliases). The parser lowercases and validates the value; anything else raises this error.

Source

Thrown at kitty/options/parse.py:1377

            raise ValueError(f"The value {val} is not a valid choice for strip_trailing_spaces")
        ans["strip_trailing_spaces"] = val

    choices_for_strip_trailing_spaces = frozenset(('always', 'never', 'smart'))

    def symbol_map(self, val: str, ans: dict[str, typing.Any]) -> None:
        for k, v in symbol_map(val):
            ans["symbol_map"][k] = v

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

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

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

    choices_for_tab_bar_align = frozenset(('start', 'center', 'end', 'left', 'right'))

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

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

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

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

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

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use one of: start, center, end, left, right
  2. Fix typos — the value must exactly match a keyword after lowercasing
  3. Prefer logical values start/end for RTL-safe configs

Example fix

# before
tab_bar_align middle
# after
tab_bar_align center
Defensive patterns

Strategy: validation

Validate before calling

value = value.lower()
if value not in ('start','center','end','left','right'):
    raise SystemExit(f'bad tab_bar_align: {value}')

Type guard

def is_tab_bar_align(v: str) -> bool:
    return v.lower() in ('start','center','end','left','right')

Prevention

When it happens

Trigger: Setting `tab_bar_align middle`, `tab_bar_align center-left`, or a misspelled value like `centere` in kitty.conf.

Common situations: Guessing 'middle' instead of 'center'; mixing logical (start/end) and physical (left/right) values incorrectly for the current layout; typos from hand-editing configs.

Related errors


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