kovidgoyal/kitty · error · ValueError

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

Error message

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

What it means

tab_switch_strategy defines how kitty picks the next tab when switching and must be one of last, left, previous, right. The parser lowercases and validates the value against a frozenset.

Source

Thrown at kitty/options/parse.py:1431

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

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

    choices_for_tab_powerline_style = frozenset(('angled', 'round', 'slanted'))

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

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

    choices_for_tab_switch_strategy = frozenset(('last', 'left', 'previous', 'right'))

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

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

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

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

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

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use one of: last, left, previous, right
  2. Spell-check the value; it must be a single lowercase keyword
  3. For 'most recently used' behavior use 'last'

Example fix

# before
tab_switch_strategy recent
# after
tab_switch_strategy last
Defensive patterns

Strategy: validation

Validate before calling

value = value.lower()
if value not in ('last','left','previous','right'):
    raise SystemExit(f'bad tab_switch_strategy: {value}')

Type guard

def is_tab_switch_strategy(v: str) -> bool:
    return v.lower() in ('last','left','previous','right')

Prevention

When it happens

Trigger: Setting `tab_switch_strategy previous` works, but values like `tab_switch_strategy rightmost`, `order`, or `recent` raise this error. Also triggered by remote-control option sets with bad strings.

Common situations: Expecting MRU-style names like 'recent' or 'mru'; typos; configs shared across kitty versions where strategy names changed.

Related errors


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