{"record":{"id":"646cae76bfadc5b1","repo":"kubernetes/kops","slug":"cannot-interpret-q-value-as-int32","errorCode":null,"errorMessage":"cannot interpret %q value as int32","messagePattern":"cannot interpret %q value as int32","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/reflectutils/access.go","lineNumber":218,"sourceCode":"\tcase \"int64\", \"int32\", \"int16\", \"int\":\n\t\tswitch t {\n\t\tcase \"int\":\n\t\t\tv, err := strconv.Atoi(newValue)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot interpret %q value as integer\", newValue)\n\t\t\t}\n\t\t\tnewV = reflect.ValueOf(v)\n\t\tcase \"int16\":\n\t\t\tv, err := strconv.ParseInt(newValue, 10, 16)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot interpret %q value as int16\", newValue)\n\t\t\t}\n\t\t\tv16 := int16(v)\n\t\t\tnewV = reflect.ValueOf(v16)\n\t\tcase \"int32\":\n\t\t\tv, err := strconv.ParseInt(newValue, 10, 32)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot interpret %q value as int32\", newValue)\n\t\t\t}\n\t\t\tv32 := int32(v)\n\t\t\tnewV = reflect.ValueOf(v32)\n\t\tcase \"int64\":\n\t\t\tv, err := strconv.ParseInt(newValue, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot interpret %q value as int64\", newValue)\n\t\t\t}\n\t\t\tv64 := int64(v)\n\t\t\tnewV = reflect.ValueOf(v64)\n\t\tdefault:\n\t\t\tpanic(\"missing case in int switch\")\n\t\t}\n\n\tcase \"uint64\", \"uint32\", \"uint16\", \"uint\":\n\t\tv, err := strconv.Atoi(newValue)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot interpret %q value as unsigned integer\", newValue)","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/reflectutils/access.go#L200-L236","documentation":"The target field is int32; strconv.ParseInt(s,10,32) failed, meaning the value is not a valid integer or is outside the int32 range (-2147483648..2147483647).","triggerScenarios":"SetString on an int32 field with \"9999999999\" or a non-numeric string.","commonSituations":"Large IDs, sizes, or byte counts fed to int32 fields via `kops set`; values copied from YAML with underscores or units.","solutions":["Use a value within int32 range.","If the real value exceeds ~2.1e9, the field type must be int64 — check the kops API type.","Pre-validate with strconv.ParseInt(v,10,32)."],"exampleFix":"// before\nSetString(&c, \"spec.someInt32Field\", \"99999999999\")\n// after\nSetString(&c, \"spec.someInt64Field\", \"99999999999\") // if field is int64","handlingStrategy":"validation","validationCode":"if _, err := strconv.ParseInt(val, 10, 32); err != nil {\n    return fmt.Errorf(\"value %q does not fit int32\", val)\n}","typeGuard":"func isInt32(s string) bool {\n    _, err := strconv.ParseInt(s, 10, 32)\n    return err == nil\n}","tryCatchPattern":"if err := SetString(&obj, path, val); err != nil {\n    if strings.Contains(err.Error(), \"as int32\") {\n        return fmt.Errorf(\"%q must fit int32 range\", val)\n    }\n    return err\n}","preventionTips":["Range-check values near 2^31 before setting.","Move large counters to int64 fields."],"tags":["go","parsing","integer","overflow"],"backgroundTag":"invalid-integer-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}