{"record":{"id":"e56a79b44963d612","repo":"kovidgoyal/kitty","slug":"invalid-size-specification-s-with-error-the-pix","errorCode":null,"errorMessage":"Invalid size specification: %s with error: The pixel width is smaller than the number of columns","messagePattern":"Invalid size specification: (.+?) with error: The pixel width is smaller than the number of columns","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/icat/main.go","lineNumber":216,"sourceCode":"\t\tvar t uint64\n\t\tif t, err = strconv.ParseUint(parts[0], 10, 16); err != nil || t < 1 {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: %w\", opts.UseWindowSize, err)\n\t\t}\n\t\tscreen_size.Col = uint16(t)\n\t\tif t, err = strconv.ParseUint(parts[1], 10, 16); err != nil || t < 1 {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: %w\", opts.UseWindowSize, err)\n\t\t}\n\t\tscreen_size.Row = uint16(t)\n\t\tif t, err = strconv.ParseUint(parts[2], 10, 16); err != nil || t < 1 {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: %w\", opts.UseWindowSize, err)\n\t\t}\n\t\tscreen_size.Xpixel = uint16(t)\n\t\tif t, err = strconv.ParseUint(parts[3], 10, 16); err != nil || t < 1 {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: %w\", opts.UseWindowSize, err)\n\t\t}\n\t\tscreen_size.Ypixel = uint16(t)\n\t\tif screen_size.Xpixel < screen_size.Col {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: The pixel width is smaller than the number of columns\", opts.UseWindowSize)\n\t\t}\n\t\tif screen_size.Ypixel < screen_size.Row {\n\t\t\treturn 1, fmt.Errorf(\"Invalid size specification: %s with error: The pixel height is smaller than the number of rows\", opts.UseWindowSize)\n\t\t}\n\t}\n\n\tif opts.PrintWindowSize {\n\t\tfmt.Printf(\"%dx%d\", screen_size.Xpixel, screen_size.Ypixel)\n\t\treturn 0, nil\n\t}\n\tif opts.Clear {\n\t\tcc := &graphics.GraphicsCommand{}\n\t\tcc.SetAction(graphics.GRT_action_delete).SetDelete(graphics.GRT_free_visible)\n\t\tif err = cc.WriteWithPayloadTo(os.Stdout, nil); err != nil {\n\t\t\treturn 1, err\n\t\t}\n\t}\n\tswitch {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/icat/main.go#L198-L234","documentation":"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.","triggerScenarios":"--use-window-size=80,24,64,1080 — 64 pixels wide for 80 columns is physically impossible.","commonSituations":"Swapping columns and pixels in the field order; using scaled-down window metrics; script computing cells from a different window than pixels.","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"],"exampleFix":"// before\n--use-window-size=1920,1080,80,24\n// after\n--use-window-size=80,24,1920,1080","handlingStrategy":"validation","validationCode":"if xpixel < cols { log.Fatal(\"pixel width must be >= columns\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute pixels from cell size * cells","Don't swap pixel and cell fields"],"tags":["kitty","icat","window-size","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}