kovidgoyal/kitty · warning
The font specification %s is invalid as %s does not contain
Error message
The font specification %s is invalid as %s does not contain an =
What it means
The choose_fonts kitten parses a font specification string (e.g. 'family=Mono style=Bold') by splitting it into items and cutting each on '='. If an item has no '=' separator, the specification is rejected. This is a config-parsing error for user-supplied font strings.
Source
Thrown at kittens/choose_fonts/types.go:300
}
func NewFontSpec(spec string, features map[string]FeatureData) (ans FontSpec, err error) {
if spec == "" || spec == "auto" {
ans.system = settable_string{"auto", true}
return
}
parts, err := shlex.Split(spec)
if err != nil {
return
}
if !strings.Contains(parts[0], "=") {
ans.system = settable_string{spec, true}
return
}
for _, item := range parts {
k, v, found := strings.Cut(item, "=")
if !found {
return ans, fmt.Errorf("The font specification %s is invalid as %s does not contain an =", spec, item)
}
switch k {
case "family":
ans.family = settable_string{v, true}
case "style":
ans.style = settable_string{v, true}
case "full_name":
ans.full_name = settable_string{v, true}
case "postscript_name":
ans.postscript_name = settable_string{v, true}
case "variable_name":
ans.variable_name = settable_string{v, true}
case "features":
for _, x := range utils.NewSeparatorScanner(v, " ").Split(v) {
pff, err := NewParsedFontFeature(x, features)
if err != nil {
return ans, err
}View on GitHub (pinned to 6d5d0c4406)
Solutions
- Rewrite the spec as key=value pairs, e.g. 'family=JetBrains Mono style=Bold'
- Quote the whole spec so the shell doesn't split it into stray items
- Check for stray commas/spaces that create standalone tokens without '='
Example fix
// before spec := "JetBrains Mono" // after spec := "family=JetBrains Mono"
Defensive patterns
Strategy: validation
Validate before calling
func validFontSpec(spec string) bool {
for _, item := range strings.Fields(spec) {
if _, _, ok := strings.Cut(item, "="); !ok {
return false
}
}
return true
} Try / catch
if err := parseFontSpec(spec); err != nil { log.Printf("bad font spec %q: %v", spec, err) } Prevention
- Always use key=value pairs (family=, style=, size=) in font specs
- Shell-quote the entire spec so spaces don't split items
When it happens
Trigger: Calling the font specification parser with a spec like 'Mono' or 'Mono Bold' where an item lacks key=value form; passing a malformed --font-spec / font family string to the choose_fonts kitten.
Common situations: Typing a bare font family name instead of 'family=Name', forgetting the '=' in 'style=Bold', extra spaces producing items like 'Bold' without a key.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Warning: unable to parse dircolors line "{line}"
- must have codepoints AND font name
- Failed to find the kitty executable, this kitten requires th
- Trying to send data when to pipe is nil
- Could not encode message to kitty with error: %w
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/5c25604dd9041a90.
Report an issue: GitHub.