{"record":{"id":"8d27469d00e9e7ef","repo":"larksuite/cli","slug":"not-numeric","errorCode":null,"errorMessage":"not numeric","messagePattern":"not numeric","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_binder.go","lineNumber":653,"sourceCode":"func isSignedIntegerKind(kind reflect.Kind) bool { return kind >= reflect.Int && kind <= reflect.Int64 }\nfunc isUnsignedIntegerKind(kind reflect.Kind) bool {\n\treturn kind >= reflect.Uint && kind <= reflect.Uint64\n}\n\nfunc numericFloat(value any) (float64, error) {\n\tv := reflect.ValueOf(value)\n\tfor v.Kind() == reflect.Pointer {\n\t\tv = v.Elem()\n\t}\n\tswitch v.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn float64(v.Int()), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\t\treturn float64(v.Uint()), nil\n\tcase reflect.Float32, reflect.Float64:\n\t\treturn v.Float(), nil\n\t}\n\treturn 0, fmt.Errorf(\"not numeric\")\n}\n","sourceCodeStart":635,"sourceCodeEnd":655,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_binder.go#L635-L655","documentation":"numericFloat converts an arbitrary Go value to float64 via reflection and returns this plain error when the underlying kind is none of the signed/unsigned int or float kinds. It is an internal helper used by validateCompiledValue, so the error indicates a non-numeric Go value reached a numeric field check.","triggerScenarios":"validateCompiledValue calling numericFloat on a field whose reflected Go value is a string, bool, slice, map, or nil — typically a binder wiring bug where the compiled field's Go type does not match the declared numeric shape.","commonSituations":"Refactors that change a struct field's type (e.g. from int to string) without updating the shape declaration; plugin/extension code feeding untyped values into compiled validation; nil values passed where numbers are expected.","solutions":["If you develop the shortcut/plugin, make the Go field type numeric (int/int64/float64/uint...) to match the declared shape.","Check for nil or string values being assigned to numeric fields before validation.","Upgrade lark-cli if this occurs with a stock command — it indicates a metadata/binder mismatch and should be reported with the command name.","Convert strings to numbers explicitly before validation if you control the input."],"exampleFix":"// before\nvar count any = \"5\" // string reaches numericFloat\nf, err := numericFloat(count) // not numeric\n\n// after\ncountInt, _ := strconv.Atoi(\"5\")\nf, err := numericFloat(countInt) // 5, nil","handlingStrategy":"type-guard","validationCode":"switch v := x.(type) {\ncase int, int64, float64, uint64:\n    // safe to pass to numeric validation\ndefault:\n    return fmt.Errorf(\"expected numeric value, got %T\", x)\n}","typeGuard":"func isNumeric(v any) bool {\n    switch reflect.ValueOf(v).Kind() {\n    case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,\n        reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,\n        reflect.Float32, reflect.Float64:\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err != nil && err.Error() == \"not numeric\" {\n    // non-numeric value reached a numeric field: fix the field wiring/type\n    return fmt.Errorf(\"field wiring bug: numeric field got %T\", input)\n}","preventionTips":["Keep compiled field Go types aligned with their declared numeric shapes.","Handle nil before numeric conversion paths.","Add a unit test asserting numeric fields reject non-numeric Go types cleanly.","After changing a field's type, regenerate/re-check its shape declaration."],"tags":["internal","reflection","type-mismatch","numeric"],"backgroundTag":"type-mismatch","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}