kovidgoyal/kitty · error
Invalid size specification: %s with error: The pixel width i
Error message
Invalid size specification: %s with error: The pixel width is smaller than the number of columns
What it means
After parsing, icat validates that pixel width is at least the column count (each cell must be >= 1 pixel wide). This error means Xpixel < Col in the --use-window-size spec.
Source
Thrown at kittens/icat/main.go:216
var t uint64
if t, err = strconv.ParseUint(parts[0], 10, 16); err != nil || t < 1 {
return 1, fmt.Errorf("Invalid size specification: %s with error: %w", opts.UseWindowSize, err)
}
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 {View on GitHub (pinned to 6d5d0c4406)
Solutions
- Make pixel width >= columns (typically ~cell_width * columns)
- Double-check field order: COLS,ROWS,XPIXEL,YPIXEL
- If unsure of the cell size, divide pixels by columns to sanity-check >= 1
Example fix
// before --use-window-size=1920,1080,80,24 // after --use-window-size=80,24,1920,1080
Defensive patterns
Strategy: validation
Validate before calling
if xpixel < cols { log.Fatal("pixel width must be >= columns") } Prevention
- Compute pixels from cell size * cells
- Don't swap pixel and cell fields
When it happens
Trigger: --use-window-size=80,24,64,1080 — 64 pixels wide for 80 columns is physically impossible.
Common situations: Swapping columns and pixels in the field order; using scaled-down window metrics; script computing cells from a different window than pixels.
Related errors
- Invalid size specification: %s with error: The pixel height
- 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/e56a79b44963d612.
Report an issue: GitHub.