larksuite/cli · error
maximum must be an integer
Error message
maximum must be an integer
What it means
Compile-time guard in shapeForType: a maximum constraint on an integer field is not a whole number and cannot be narrowed to int64.
Source
Thrown at shortcuts/common/typed_compile_data.go:108
return nil, fmt.Errorf("boolean field has incompatible schema constraint")
}
shape = booleanShape
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
if input && baseType.Kind() >= reflect.Uint && baseType.Kind() <= reflect.Uint64 {
return nil, fmt.Errorf("unsigned integer CLI input %s is not supported; use int or an explicit JSON encoding", baseType)
}
integerShape := typedIntegerShape{}
if schema.minimum != nil {
v := int64(*schema.minimum)
if float64(v) != *schema.minimum {
return nil, fmt.Errorf("minimum must be an integer")
}
integerShape.Minimum = &v
}
if schema.maximum != nil {
v := int64(*schema.maximum)
if float64(v) != *schema.maximum {
return nil, fmt.Errorf("maximum must be an integer")
}
integerShape.Maximum = &v
}
for _, raw := range schema.enum {
v, err := strconv.ParseInt(raw, 10, baseType.Bits())
if err != nil {
return nil, fmt.Errorf("enum value %q is not integer", raw)
}
integerShape.Enum = append(integerShape.Enum, v)
}
if hasStringConstraints(schema) || hasItemConstraints(schema) || schema.format != "" {
return nil, fmt.Errorf("integer field has incompatible schema constraint")
}
shape = integerShape
case reflect.Float32, reflect.Float64:
numberShape := typedNumberShape{Minimum: schema.minimum, Maximum: schema.maximum}
for _, raw := range schema.enum {
v, err := parseFiniteFloatBits(raw, baseType.Bits())View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Use an integer literal for maximum on int fields
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/common/typed_compile_data.go:108 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/b4acd8a3a1cf1333.
Report an issue: GitHub.