kovidgoyal/kitty · error · ValueError
The value {val} is not a valid choice for strip_trailing_spa
Error message
The value {val} is not a valid choice for strip_trailing_spaces What it means
strip_trailing_spaces in kitty.conf must be one of always, never, or smart. The parser lowercases and validates against a frozenset; anything else aborts option parsing with this ValueError.
Source
Thrown at kitty/options/parse.py:1359
def shell_integration(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['shell_integration'] = shell_integration(val)
def show_hyperlink_targets(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['show_hyperlink_targets'] = show_hyperlink_targets(val)
def single_window_margin_width(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['single_window_margin_width'] = optional_edge_width(val)
def single_window_padding_width(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['single_window_padding_width'] = optional_edge_width(val)
def startup_session(self, val: str, ans: dict[str, typing.Any]) -> None:
ans['startup_session'] = config_or_absolute_path(val)
def strip_trailing_spaces(self, val: str, ans: dict[str, typing.Any]) -> None:
val = val.lower()
if val not in self.choices_for_strip_trailing_spaces:
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")View on GitHub (pinned to 6d5d0c4406)
Solutions
- Replace the value with always, never, or smart
- Do not use yes/no/true/false for this option
- Check the option docs if unsure which keyword your kitty version supports
Example fix
# before strip_trailing_spaces yes # after strip_trailing_spaces smart
Defensive patterns
Strategy: validation
Validate before calling
value = value.lower()
if value not in ('always','never','smart'):
raise SystemExit(f'bad strip_trailing_spaces: {value}') Type guard
def is_strip_trailing_spaces(v: str) -> bool:
return v.lower() in ('always','never','smart') Prevention
- Remember this option is keyword-based, not boolean
- Use --debug-config after editing kitty.conf
When it happens
Trigger: Setting `strip_trailing_spaces yes`, `strip_trailing_spaces true`, or `strip_trailing_spaces Smart ` (typo) in kitty.conf. Note booleans are not accepted — only the three keywords.
Common situations: Users familiar with kitty's other boolean options (which take yes/no) assuming this one is boolean too; older kitty versions accepted only smart/never and new values confuse migrations.
Related errors
- The value {x} is not a known choice
- The value {val} is not a valid choice for progress_bar
- The value {val} is not a valid choice for scrollbar
- The value {val} is not a valid choice for tab_bar_align
- The value {val} is not a valid choice for tab_bar_style
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/c25f33f1c1a109ed.
Report an issue: GitHub.