kovidgoyal/kitty · error
unknown fit specification: %#v
Error message
unknown fit specification: %#v
What it means
--fit must be one of the recognized keywords (scale, height/xx, none/neither, both); anything else hits the default case.
Source
Thrown at kittens/icat/main.go:113
if err != nil {
return fmt.Errorf("Invalid value for --z-index with error: %w", err)
}
z_index = int32(i) + origin
return
}
func parse_fit() (err error) {
switch strings.ToLower(opts.Fit) {
case "width":
fit_mode = fit_width
case "height":
fit_mode = fit_height
case "none", "neither":
fit_mode = fit_none
case "both":
fit_mode = fit_both
default:
return fmt.Errorf("unknown fit specification: %#v", opts.Fit)
}
return nil
}
func parse_place() (err error) {
if opts.Place == "" {
return nil
}
area, pos, found := strings.Cut(opts.Place, "@")
if !found {
return fmt.Errorf("Invalid --place specification: %s", opts.Place)
}
w, h, found := strings.Cut(area, "x")
if !found {
return fmt.Errorf("Invalid --place specification: %s", opts.Place)
}
l, t, found := strings.Cut(pos, "x")
if !found {View on GitHub (pinned to 6d5d0c4406)
Solutions
- Use a supported keyword: scale (default), height, none/neither, or both
- Check kitty docs for the icat --fit option in your version
Example fix
# before kitty +kitten icat --fit=contain img.png # after kitty +kitten icat --fit=both img.png
Defensive patterns
Strategy: type-guard
Validate before calling
var validFit = map[string]bool{"scale":true,"height":true,"xx":true,"none":true,"neither":true,"both":true} Type guard
func isValidFit(s string) bool { switch s { case "scale","height","xx","none","neither","both": return true }; return false } Prevention
- Whitelist fit keywords at the CLI wrapper
- Keep docs handy for supported keywords
When it happens
Trigger: --fit=fill, --fit=width, or a typo like --fit=boths.
Common situations: Assuming CSS-like object-fit values (fill, contain) or guessing 'width' which isn't supported.
Related errors
- Invalid value for --background: %w
- Invalid value for --z-index with error: %w
- Invalid --place specification: %s
- Unknown extra argument(s) supplied to {command.name}
- 'size' must be a non-negative integer
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/ea09fedcfd2cc020.
Report an issue: GitHub.