kovidgoyal/kitty · error
Invalid size specification: %s with error: The pixel height
Error message
Invalid size specification: %s with error: The pixel height is smaller than the number of rows
What it means
Cross-field validation: pixel height (Ypixel) must be at least the row count. The spec's fourth number is smaller than its second number.
Source
Thrown at kittens/icat/main.go:219
}
screen_size.Col = uint16(t)
if t, err = strconv.ParseUint(parts[1], 10, 16); err != nil || t < 1 {
return 1, fmt.Errorf("Invalid size specification: %s with error: %w", opts.UseWindowSize, err)
}
screen_size.Row = uint16(t)
if t, err = strconv.ParseUint(parts[2], 10, 16); err != nil || t < 1 {
return 1, fmt.Errorf("Invalid size specification: %s with error: %w", opts.UseWindowSize, err)
}
screen_size.Xpixel = uint16(t)
if t, err = strconv.ParseUint(parts[3], 10, 16); err != nil || t < 1 {
return 1, fmt.Errorf("Invalid size specification: %s with error: %w", opts.UseWindowSize, err)
}
screen_size.Ypixel = uint16(t)
if screen_size.Xpixel < screen_size.Col {
return 1, fmt.Errorf("Invalid size specification: %s with error: The pixel width is smaller than the number of columns", opts.UseWindowSize)
}
if screen_size.Ypixel < screen_size.Row {
return 1, fmt.Errorf("Invalid size specification: %s with error: The pixel height is smaller than the number of rows", opts.UseWindowSize)
}
}
if opts.PrintWindowSize {
fmt.Printf("%dx%d", screen_size.Xpixel, screen_size.Ypixel)
return 0, nil
}
if opts.Clear {
cc := &graphics.GraphicsCommand{}
cc.SetAction(graphics.GRT_action_delete).SetDelete(graphics.GRT_free_visible)
if err = cc.WriteWithPayloadTo(os.Stdout, nil); err != nil {
return 1, err
}
}
switch {
case opts.ClearAll:
cc := &graphics.GraphicsCommand{}
cc.SetAction(graphics.GRT_action_delete).SetDelete(graphics.GRT_free_by_range).SetLeftEdge(0).SetTopEdge(math.MaxUint32)View on GitHub (pinned to 6d5d0c4406)
Solutions
- Make pixel height >= rows (cell_height * rows)
- Verify field order COLS,ROWS,XPIXEL,YPIXEL
- Recompute sizes after terminal resize instead of caching
Example fix
// before --use-window-size=80,24,1920,20 // after --use-window-size=80,24,1920,1080
Defensive patterns
Strategy: validation
Validate before calling
if ypixel < rows { log.Fatal("pixel height must be >= rows") } Prevention
- Pixel height must cover all rows
- Refresh size spec on window resize events
When it happens
Trigger: --use-window-size=80,24,1920,20 — 20 pixels tall cannot hold 24 rows.
Common situations: Swapped rows/pixels; DPI-scaled values mixed with logical rows; stale cached window size after resizing.
Related errors
- Invalid size specification: %s with error: The pixel width i
- Invalid size specification: %s
- Invalid size specification: %s with error: %w
- Unknown type_of_input: {type_of_input}
- Unknown keys in multicell_command:
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/619151ea1d298195.
Report an issue: GitHub.