{"record":{"id":"be02f25f0e56e969","repo":"kovidgoyal/kitty","slug":"invalid-value-for-z-index-with-error-w","errorCode":null,"errorMessage":"Invalid value for --z-index with error: %w","messagePattern":"Invalid value for --z-index with error: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/icat/main.go","lineNumber":96,"sourceCode":"\t}\n\tcol, err := style.ParseColor(opts.Background)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Invalid value for --background: %w\", err)\n\t}\n\tremove_alpha = &imaging.NRGBColor{R: col.Red, G: col.Green, B: col.Blue}\n\treturn\n}\n\nfunc parse_z_index() (err error) {\n\tval := opts.ZIndex\n\tvar origin int32\n\tif strings.HasPrefix(val, \"--\") {\n\t\torigin = -1073741824\n\t\tval = val[1:]\n\t}\n\ti, err := strconv.ParseInt(val, 10, 32)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Invalid value for --z-index with error: %w\", err)\n\t}\n\tz_index = int32(i) + origin\n\treturn\n}\n\nfunc parse_fit() (err error) {\n\tswitch strings.ToLower(opts.Fit) {\n\tcase \"width\":\n\t\tfit_mode = fit_width\n\tcase \"height\":\n\t\tfit_mode = fit_height\n\tcase \"none\", \"neither\":\n\t\tfit_mode = fit_none\n\tcase \"both\":\n\t\tfit_mode = fit_both\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown fit specification: %#v\", opts.Fit)\n\t}","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/icat/main.go#L78-L114","documentation":"--z-index takes an optionally '--'-prefixed integer (prefix sets a negative origin of -1073741824); the remainder must parse as a 32-bit int. ParseInt failure produces this error.","triggerScenarios":"--z-index=abc, --z-index=1.5, or a value overflowing int32 range.","commonSituations":"Passing a float or non-numeric value; misunderstanding that only integers (optionally prefixed with '--' for negative origin) are accepted.","solutions":["Pass a plain integer: --z-index=5","For negative stacking use the '--' prefix form as documented, not '-5'","Keep magnitude within int32 range"],"exampleFix":"# before\nkitty +kitten icat --z-index=-5 img.png\n# after\nkitty +kitten icat --z-index=--5 img.png","handlingStrategy":"validation","validationCode":"if _, err := strconv.ParseInt(strings.TrimPrefix(val, \"-\"), 10, 32); err != nil { /* reject before running icat */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass integers only","Use '--' prefix for the negative z-index origin form"],"tags":["kitty","icat","z-index","argument-validation"],"backgroundTag":"invalid-numeric-argument","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}