larksuite/cli · error
%s must be at least %v
Error message
%s must be at least %v
What it means
This is a typed-flag shape validation error from the lark-cli shortcut binder. When a shortcut field is declared with a number shape carrying a minimum constraint, any supplied numeric value below that minimum is rejected before any API call is made. The message names the failing field path and the required lower bound.
Source
Thrown at shortcuts/common/typed_binder.go:462
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:
items, ok := value.([]any)
if !ok {
return fmt.Errorf("%s must be an array", path)
}
if constraint.MinItems != nil && len(items) < *constraint.MinItems {
return fmt.Errorf("%s must contain at least %d items", path, *constraint.MinItems)
}
if constraint.MaxItems != nil && len(items) > *constraint.MaxItems {
return fmt.Errorf("%s must contain at most %d items", path, *constraint.MaxItems)
}
for i, item := range items {
if err := validateJSONValueAgainstShape(item, constraint.Items, fmt.Sprintf("%s[%d]", path, i)); err != nil {View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Read the bound in the message and supply a value >= that minimum.
- Check the command's --help or schema output for the documented range of the field.
- If the value comes from config/CLI input, clamp or validate it before invoking the command.
- If you believe the minimum is wrong, check the upstream OpenAPI field constraint; the shape is generated from metadata.
Example fix
// before lark-cli shortcut demo --page-size 0 // error: page_size must be at least 1 // after lark-cli shortcut demo --page-size 10
Defensive patterns
Strategy: validation
Validate before calling
const minCount = 1
if pageSize < minCount {
return fmt.Errorf("page_size must be at least %d", minCount)
}
// proceed with the command invocation Type guard
func inRangeInt(v, min, max int64) bool { return v >= min && v <= max } Prevention
- Check --help/schema for declared min/max before scripting a command.
- Clamp user/config-supplied numbers to documented ranges before invocation.
- Add a shell precondition test ([ "$N" -ge 1 ]) around numeric flags.
- Prefer pagination over extreme page_size values.
When it happens
Trigger: Calling a shortcut/typed command with a numeric flag (or a JSON value validated against a compiled shape) whose value is less than the shape's declared Minimum — e.g. --count=0 when the shape requires >= 1.
Common situations: Off-by-one defaults, passing 0 or negative values where the Lark API requires a positive number, copying example payloads with out-of-range sizes (page_size, limit), or unit confusion (minutes vs seconds).
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 %v
- please select at least one domain
- %s must contain at most %d characters
- %s must be one of: %s
- %s must be a boolean
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/ada4f2df341e7170.
Report an issue: GitHub.