larksuite/cli · error
not numeric
Error message
not numeric
What it means
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.
Source
Thrown at shortcuts/common/typed_binder.go:653
func isSignedIntegerKind(kind reflect.Kind) bool { return kind >= reflect.Int && kind <= reflect.Int64 }
func isUnsignedIntegerKind(kind reflect.Kind) bool {
return kind >= reflect.Uint && kind <= reflect.Uint64
}
func numericFloat(value any) (float64, error) {
v := reflect.ValueOf(value)
for v.Kind() == reflect.Pointer {
v = v.Elem()
}
switch v.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
return float64(v.Int()), nil
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return float64(v.Uint()), nil
case reflect.Float32, reflect.Float64:
return v.Float(), nil
}
return 0, fmt.Errorf("not numeric")
}
View on GitHub (pinned to 7fd6ef3c07)
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.
Example fix
// before
var count any = "5" // string reaches numericFloat
f, err := numericFloat(count) // not numeric
// after
countInt, _ := strconv.Atoi("5")
f, err := numericFloat(countInt) // 5, nil Defensive patterns
Strategy: type-guard
Validate before calling
switch v := x.(type) {
case int, int64, float64, uint64:
// safe to pass to numeric validation
default:
return fmt.Errorf("expected numeric value, got %T", x)
} Type guard
func isNumeric(v any) bool {
switch reflect.ValueOf(v).Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
reflect.Float32, reflect.Float64:
return true
}
return false
} Try / catch
if err != nil && err.Error() == "not numeric" {
// non-numeric value reached a numeric field: fix the field wiring/type
return fmt.Errorf("field wiring bug: numeric field got %T", input)
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- %T is not assignable to %s
- exec provider: failed to marshal request: %w
- exec provider value for id %q is not a string
- file provider JSON Pointer %q resolved to non-string value
- expected hello_ack, got %T
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/8d27469d00e9e7ef.
Report an issue: GitHub.