larksuite/cli · error
minimum exceeds maximum
Error message
minimum exceeds maximum
What it means
When both `minimum` and `maximum` numeric bounds are declared in a schema tag, the minimum must not exceed the maximum. An inverted range can never be satisfied, so parseSchemaTag rejects the tag at compile time.
Source
Thrown at shortcuts/common/typed_compile_args.go:507
result.maxItems = &v
default:
return result, fmt.Errorf("unknown schema token %q", key)
}
}
if result.required == result.optional {
return result, fmt.Errorf("schema must declare exactly one of required or optional")
}
if result.required && result.defaultValue.Set {
return result, fmt.Errorf("required input cannot declare default")
}
if result.nullable != nil && *result.nullable && !isNilCapable(valueType) {
return result, fmt.Errorf("nullable requires a nil-capable Go type")
}
if result.minLength != nil && result.maxLength != nil && *result.minLength > *result.maxLength {
return result, fmt.Errorf("minLength exceeds maxLength")
}
if result.minimum != nil && result.maximum != nil && *result.minimum > *result.maximum {
return result, fmt.Errorf("minimum exceeds maximum")
}
if result.minItems != nil && result.maxItems != nil && *result.minItems > *result.maxItems {
return result, fmt.Errorf("minItems exceeds maxItems")
}
return result, nil
}
func parseCLITag(raw string) (typedCLIInput, error) {
var result typedCLIInput
if raw == "" {
return result, nil
}
seen := make(map[string]struct{})
for _, token := range strings.Split(raw, ";") {
key, value, ok := strings.Cut(token, "=")
if !ok || value == "" || token != strings.TrimSpace(token) {
return result, fmt.Errorf("invalid cli token %q", token)
}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Ensure minimum <= maximum in the tag.
- Swap the two values if inverted.
- Remove the redundant bound if only one limit is meaningful.
Example fix
// before Amount float64 `schema:"required;minimum=100;maximum=10"` // after Amount float64 `schema:"required;minimum=10;maximum=100"`
Defensive patterns
Strategy: validation
Validate before calling
func numericRangeOK(min, max *float64) bool {
return min == nil || max == nil || *min <= *max
} Prevention
- State bounds as an interval [minimum, maximum] and verify ordering.
- Update minimum and maximum in the same edit when requirements shift.
- Add a compile-time test over all numeric input fields.
When it happens
Trigger: A tag like schema:"optional;minimum=100;maximum=10" on a numeric input field.
Common situations: Transcribing bounds in the wrong order, changing one bound after a requirements change, or copying bounds from an inverted spec.
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
- minLength exceeds maxLength
- minItems exceeds maxItems
- schema minItems: %w
- schema maxItems: %w
- unknown schema token %q
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/f170e163303dd55f.
Report an issue: GitHub.