larksuite/cli · error
%s must be at least %d
Error message
%s must be at least %d
What it means
The integer value is valid but falls below the schema's minimum (constraint.Minimum). validateJSONValueAgainstShape compares the decoded number against the declared bound and refuses out-of-range input before the API call. The message names the field path and the required minimum.
Source
Thrown at shortcuts/common/typed_binder.go:444
return fmt.Errorf("%s must be one of: %s", path, strings.Join(constraint.Enum, ", "))
}
return nil
case typedBooleanShape:
boolean, ok := value.(bool)
if !ok {
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)View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Raise the value to at least the minimum shown in the error message
- Clamp or validate the value before the call: if v < min { v = min }
- Fix the computation that produced the too-small value (e.g. use max(1, n))
- Check `schema` for the exact bound if the message context is unclear
Example fix
// before
pageSize := userPageSize // can be 0
// after
if pageSize < 1 {
pageSize = 1
} Defensive patterns
Strategy: validation
Validate before calling
func clampMin(v int, min int) int {
if v < min {
return min
}
return v
} // call as clampMin(pageSize, 1) after reading the bound from `schema` Type guard
func isWithinMin(v int, min int) bool { return v >= min } Try / catch
if err := bind(field, n); err != nil {
var minErr *RangeError
if strings.Contains(err.Error(), "must be at least") {
return fmt.Errorf("field %s below minimum: %w", field, err)
}
return err
} Prevention
- Clamp numeric inputs to schema bounds at the entry point of your script
- Replace placeholder defaults (0, -1) with the schema minimum
- Check `schema` for min/max when introducing a new field into automation
- Add tests covering boundary values (min-1, min, max, max+1)
When it happens
Trigger: Passing a value smaller than the field's declared minimum (e.g. page_size=0 where min is 1; a negative count); computed values that can hit zero/negative under edge cases.
Common situations: Default/empty variables (0 or -1 placeholders) flowing into requests; off-by-one in pagination code; business rules where the API requires at least 1 item or 1 unit.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- %s must be at most %d
- %s must be an integer
- %s has an unsupported integer value
- expected integer
- please select at least one domain
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/959a4be9a13e881a.
Report an issue: GitHub.