kovidgoyal/kitty · warning
Ignoring invalid config line: {line!r}
Error message
Ignoring invalid config line: {line!r} What it means
While parsing a kitty config file, a non-empty non-comment line did not match kitty's `key value` pattern; the line is skipped.
Source
Thrown at kitty/conf/utils.py:292
return False
def parse_line(
line: str,
parse_conf_item: ItemParser,
ans: dict[str, Any],
base_path_for_includes: str,
effective_config_lines: Callable[[str, str], None],
memory: Memory,
accumulate_bad_lines: list[BadLine] | None = None,
allow_geninclude: bool = True,
) -> None:
line = line.strip()
if not line or line.startswith('#'):
return
m = key_pat.match(line)
if m is None:
log_error(f'Ignoring invalid config line: {line!r}')
return
key, val = m.groups()
if key.endswith('include') and key in include_keys:
val = expandvars(os.path.expanduser(val.strip()), {'KITTY_OS': os_name()})
if key == 'globinclude':
from pathlib import Path
vals = tuple(map(lambda x: str(os.fspath(x)), sorted(Path(base_path_for_includes).glob(val))))
elif key == 'envinclude':
from fnmatch import fnmatchcase
for x in os.environ:
if fnmatchcase(x, val):
with currently_parsing.set_file(f'<env var: {x}>'):
_parse(
NamedLineIterator(os.path.join(base_path_for_includes, ''), iter(os.environ[x].splitlines())),
parse_conf_item,
ans,View on GitHub (pinned to 6d5d0c4406)
Solutions
- Recheck the logged line — add the missing space between key and value
- Retype the line instead of copy-pasting to kill smart quotes
- Keep `key value` form: one space, ASCII
Example fix
# before font_size11.0 # after font_size 11.0
Defensive patterns
Strategy: validation
Validate before calling
import re
key_pat = re.compile(r'^([a-zA-Z0-9_]+)\s+(.+)$')
assert key_pat.match(line), f'bad line: {line!r}' Prevention
- Retype config lines instead of copy-pasting from the web
- Lint kitty.conf after edits: kitty --debug-config
When it happens
Trigger: Lines with no space between key and value, stray characters, or values starting before the key; key_pat.match fails.
Common situations: Missing space (`font_size11.0`), smart/curly quotes introduced by copy-paste from websites, or stray unicode/BOM characters at line start.
Related errors
- This should be run as kitten broadcast
- No option named: {k}
- No custom kitten named {kitten} found
- Not a number: {x} with error: {e}
- Not a valid unit: {x}. Allowed units are: {default_unit}, {"
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/56e38aa2e5a0a348.
Report an issue: GitHub.