larksuite/cli · error
number field has incompatible schema constraint
Error message
number field has incompatible schema constraint
What it means
Compile-time guard in shapeForType: a float field declares string constraints, item constraints, or a format, which are incompatible with number types.
Source
Thrown at shortcuts/common/typed_compile_data.go:133
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())
if err != nil {
return nil, fmt.Errorf("enum value %q is not a finite number", raw)
}
numberShape.Enum = append(numberShape.Enum, v)
}
if hasStringConstraints(schema) || hasItemConstraints(schema) || schema.format != "" {
return nil, fmt.Errorf("number field has incompatible schema constraint")
}
shape = numberShape
case reflect.Slice, reflect.Array:
if baseType == jsonRawMessageType {
return nil, fmt.Errorf("json.RawMessage requires an explicit Shape")
}
if baseType.Elem().Kind() == reflect.Uint8 {
return nil, fmt.Errorf("byte slice or array %s requires an explicit Shape", baseType)
}
if len(schema.enum) > 0 || hasStringConstraints(schema) || hasNumberConstraints(schema) || schema.format != "" {
return nil, fmt.Errorf("array field has incompatible schema constraint")
}
elementSchema := schemaTag{required: true}
elementShape, err := shapeForType(baseType.Elem(), elementSchema, input, active)
if err != nil {
return nil, fmt.Errorf("array item: %w", err)
}
shape = typedArrayShape{Items: elementShape, MinItems: schema.minItems, MaxItems: schema.maxItems}View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Remove string/item/format constraints from the number field
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at shortcuts/common/typed_compile_data.go:133 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/22af91cacccc091d.
Report an issue: GitHub.