larksuite/cli · error
%s has an unsupported integer value
Error message
%s has an unsupported integer value
What it means
The value is an acceptable integer but is not a member of the field's integer enum (constraint.Enum). This is a value-set rejection, not a range or type issue: the schema restricts the field to specific discrete values (e.g. only 1, 2, 4 for a size selector).
Source
Thrown at shortcuts/common/typed_binder.go:450
return fmt.Errorf("%s must be a boolean", path)
}
if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, boolean) {
return fmt.Errorf("%s has an unsupported boolean value", path)
}
return nil
case typedIntegerShape:
number, ok := validationInteger(value)
if !ok {
return fmt.Errorf("%s must be an integer", path)
}
if constraint.Minimum != nil && number < *constraint.Minimum {
return fmt.Errorf("%s must be at least %d", path, *constraint.Minimum)
}
if constraint.Maximum != nil && number > *constraint.Maximum {
return fmt.Errorf("%s must be at most %d", path, *constraint.Maximum)
}
if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {
return fmt.Errorf("%s has an unsupported integer value", path)
}
return nil
case typedNumberShape:
number, ok := validationNumber(value)
if !ok {
return fmt.Errorf("%s must be a number", path)
}
if len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {
return fmt.Errorf("%s has an unsupported number value", path)
}
if constraint.Minimum != nil && number < *constraint.Minimum {
return fmt.Errorf("%s must be at least %v", path, *constraint.Minimum)
}
if constraint.Maximum != nil && number > *constraint.Maximum {
return fmt.Errorf("%s must be at most %v", path, *constraint.Maximum)
}
return nil
case typedArrayShape:View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Pick one of the supported values (see `schema` for the enum list)
- Map user input to the nearest allowed tier before the call
- If a formerly accepted value fails, refresh the CLI catalog metadata
- Do not round to an arbitrary nearby value — only listed values pass
Example fix
// before
size := 3
// after
allowed := []int{1, 2, 4}
slices.Sort(allowed)
i, _ := slices.BinarySearch(allowed, size)
if i == len(allowed) { i = len(allowed)-1 }
size = allowed[i] Defensive patterns
Strategy: validation
Validate before calling
func snapToEnum(v int, allowed []int) (int, error) {
if slices.Contains(allowed, v) {
return v, nil
}
return 0, fmt.Errorf("%d not in allowed set %v", v, allowed)
} Type guard
func isAllowedInt(v any, allowed ...int) bool {
n, ok := v.(int)
return ok && slices.Contains(allowed, n)
} Try / catch
if err := bind(field, n); err != nil {
if strings.Contains(err.Error(), "unsupported integer value") {
return fmt.Errorf("field %s accepts only specific values; see `lark ... schema`: %w", field, err)
}
return err
} Prevention
- Map user input onto the documented tier list instead of passing raw numbers
- Keep the accepted integer set as constants mirroring `schema` output
- Refresh CLI catalog metadata if the accepted set appears to have changed
When it happens
Trigger: Passing 3 where the schema enum is [1,2,4]; using an arbitrary count for a field that models fixed tiers; IDs encoded as enum-like integers validated through validateCompiledValue/valueCompatibleWithShape.
Common situations: Choosing sizes/multipliers not in the supported tier list; guessing numeric option codes instead of looking them up; API version differences changing the allowed set.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- %s must be one of: %s
- %s has an unsupported boolean value
- %s must be an integer
- %s must be at least %d
- %s must be at most %d
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/9f667cdb23c3877b.
Report an issue: GitHub.