kovidgoyal/kitty · warning
Invalid config line: %#v
Error message
Invalid config line: %#v
What it means
A line in a config file did not match the expected `key value` pattern and could not be parsed. The offending raw line is echoed with %#v formatting so exact whitespace/content is visible.
Source
Thrown at tools/config/api.go:195
} else {
next_line = ""
}
}
} else {
next_line = ""
}
if line[0] == '#' {
if self.CommentsHandler != nil {
if err := self.CommentsHandler(line); err != nil {
add_bad_line(err)
}
}
continue
}
m := key_pat().FindStringSubmatch(line)
if len(m) < 3 {
add_bad_line(fmt.Errorf("Invalid config line: %#v", line))
continue
}
key, val := m[1], m[2]
for i, ch := range line {
if ch == ' ' || ch == '\t' {
key = line[:i]
val = strings.TrimSpace(line[i+1:])
break
}
}
switch key {
default:
if err := self.LineHandler(key, val); err != nil {
add_bad_line(err)
}
case "include", "globinclude", "envinclude", "geninclude":
var includes []string
val = ExpandVars(val)View on GitHub (pinned to 6d5d0c4406)
Solutions
- Locate the exact line using the %#v output in the error message
- Correct the syntax to `key value` or remove the obsolete directive
- Check the kitty docs for the current version to confirm the option still exists
Example fix
# before map # after map ctrl+a>1 goto_window 1
Defensive patterns
Strategy: try-catch
Validate before calling
if !keyPat.MatchString(line) && !strings.HasPrefix(line, "#") && strings.TrimSpace(line) != "" {
log.Printf("suspicious config line: %q", line)
} Try / catch
if err := config.ParseFiles("kitten.conf"); err != nil { log.Printf("config parse: %v", err) /* treat as non-fatal */ } Prevention
- Validate configs in CI with kitty's config check before deploy
- Avoid pasting snippets from other programs into kitten.conf
When it happens
Trigger: Lines that are not blank, not comments, and lack a key/value separation matching the parser's key pattern — e.g. stray characters, malformed syntax, or a directive belonging to a different program's config.
Common situations: Pasting config snippets for a different kitty version that removed/renamed a directive, invisible Unicode characters, or a missing space between key and value.
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/9a395712f2ee70c4.
Report an issue: GitHub.