{"record":{"id":"e09b28363790284f","repo":"larksuite/cli","slug":"s-has-an-unsupported-number-value","errorCode":null,"errorMessage":"%s has an unsupported number value","messagePattern":"(.+?) has an unsupported number value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_binder.go","lineNumber":459,"sourceCode":"\t\t\treturn fmt.Errorf(\"%s must be an integer\", path)\n\t\t}\n\t\tif constraint.Minimum != nil && number < *constraint.Minimum {\n\t\t\treturn fmt.Errorf(\"%s must be at least %d\", path, *constraint.Minimum)\n\t\t}\n\t\tif constraint.Maximum != nil && number > *constraint.Maximum {\n\t\t\treturn fmt.Errorf(\"%s must be at most %d\", path, *constraint.Maximum)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported integer value\", path)\n\t\t}\n\t\treturn nil\n\tcase typedNumberShape:\n\t\tnumber, ok := validationNumber(value)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a number\", path)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported number value\", path)\n\t\t}\n\t\tif constraint.Minimum != nil && number < *constraint.Minimum {\n\t\t\treturn fmt.Errorf(\"%s must be at least %v\", path, *constraint.Minimum)\n\t\t}\n\t\tif constraint.Maximum != nil && number > *constraint.Maximum {\n\t\t\treturn fmt.Errorf(\"%s must be at most %v\", path, *constraint.Maximum)\n\t\t}\n\t\treturn nil\n\tcase typedArrayShape:\n\t\titems, ok := value.([]any)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be an array\", path)\n\t\t}\n\t\tif constraint.MinItems != nil && len(items) < *constraint.MinItems {\n\t\t\treturn fmt.Errorf(\"%s must contain at least %d items\", path, *constraint.MinItems)\n\t\t}\n\t\tif constraint.MaxItems != nil && len(items) > *constraint.MaxItems {\n\t\t\treturn fmt.Errorf(\"%s must contain at most %d items\", path, *constraint.MaxItems)","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_binder.go#L441-L477","documentation":"The value is a valid number but not among the discrete values permitted by the schema's number enum. Like the integer/boolean enum errors, this is a value-set rejection raised by validateJSONValueAgainstShape after the type check passes.","triggerScenarios":"Supplying 0.5 to a field whose enum is [0.25, 1.0, 2.0]; passing an arbitrary rate/multiplier where only fixed step values are accepted; float representation edge values differing from the declared enum after JSON decode.","commonSituations":"Choosing in-between values for rate/step-like fields; converting percentages (33.3) where the API accepts fixed fractions; API updates changing the accepted set.","solutions":["Use one of the accepted values listed for the field (check `schema` output)","Snap the input to the nearest allowed enum value before the call","If a previously valid value now fails, refresh the CLI catalog metadata","Avoid computing the value at runtime unless the result is guaranteed to be in the enum"],"exampleFix":"// before\ndiscount := 0.15\n// after\ndiscount = 0.25 // must be one of the schema's enum values (e.g. 0.25, 0.5, 1.0)","handlingStrategy":"validation","validationCode":"func ensureFloatEnum(v float64, allowed []float64) error {\n    for _, a := range allowed {\n        if v == a {\n            return nil\n        }\n    }\n    return fmt.Errorf(\"%v not in allowed set %v\", v, allowed)\n}","typeGuard":"func isAllowedNumber(v any, allowed ...float64) bool {\n    n, ok := v.(float64)\n    if !ok {\n        return false\n    }\n    for _, a := range allowed {\n        if n == a {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":"if err := bind(field, v); err != nil {\n    if strings.Contains(err.Error(), \"unsupported number value\") {\n        return fmt.Errorf(\"field %s accepts only fixed values; pick from `lark ... schema`: %w\", field, err)\n    }\n    return err\n}","preventionTips":["Use the documented discrete values, not computed intermediates","Keep accepted float values as constants synced with `schema` output","Avoid floating-point arithmetic that can drift off the allowed values","Refresh CLI catalog metadata if accepted values change"],"tags":["validation","cli","enum","number"],"backgroundTag":"invalid-enum-value","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"}