larksuite/cli · error
L2: field %q enumDescriptions length (%d) != enum length (%d
Error message
L2: field %q enumDescriptions length (%d) != enum length (%d)
What it means
L2 schema lint failure: a field's enumDescriptions array length does not match its enum array length. Every enum value must have exactly one description for help/schema rendering.
Source
Thrown at internal/schema/lint.go:129
// walkForL2 recursively applies per-field L2 checks (format:binary on
// non-string; minimum>=maximum) plus the sub-object required-exists invariant.
// Required only matters on object-typed Properties (e.g. the params / data
// wrappers); leaf scalars ignore it.
func walkForL2(props *OrderedProps, errs *[]error) {
if props == nil {
return
}
for _, k := range props.Order {
p := props.Map[k]
if p.Format == "binary" && p.Type != "string" {
*errs = append(*errs, fmt.Errorf("L2: field %q has format: binary but type = %q (want string)", k, p.Type))
}
if p.Minimum != nil && p.Maximum != nil && *p.Minimum >= *p.Maximum {
*errs = append(*errs, fmt.Errorf("L2: field %q minimum (%v) >= maximum (%v)", k, *p.Minimum, *p.Maximum))
}
if n := len(p.EnumDescriptions); n > 0 && n != len(p.Enum) {
*errs = append(*errs, fmt.Errorf("L2: field %q enumDescriptions length (%d) != enum length (%d)", k, n, len(p.Enum)))
}
if len(p.Required) > 0 && p.Properties != nil {
for _, r := range p.Required {
if _, ok := p.Properties.Map[r]; !ok {
*errs = append(*errs, fmt.Errorf("L2: required key %q in %q not found in its properties", r, k))
}
}
}
if p.Properties != nil {
walkForL2(p.Properties, errs)
}
}
}
// validatePropertyTypes walks an OrderedProps tree and asserts:
// - every Property.Type is in validJSONSchemaTypes (or empty for nested objects with only properties)
// - array Properties have Items
//View on GitHub (pinned to 7fd6ef3c07)
Solutions
- Add or remove enumDescriptions entries so len matches len(enum)
- Remove enumDescriptions entirely if no descriptions are wanted (empty is allowed)
- Regenerate the schema from the upstream metadata so both arrays stay in sync
Example fix
// before Enum: ["a","b","c"], EnumDescriptions: ["A","B"] // after Enum: ["a","b","c"], EnumDescriptions: ["A","B","C"]
Defensive patterns
Strategy: validation
Validate before calling
if len(p.EnumDescriptions) > 0 && len(p.EnumDescriptions) != len(p.Enum) {
return fmt.Errorf("field %s: %d descriptions for %d enum values", name, len(p.EnumDescriptions), len(p.Enum))
} Type guard
func enumDescriptionsAligned(p *Property) bool { return len(p.EnumDescriptions) == 0 || len(p.EnumDescriptions) == len(p.Enum) } Prevention
- Update enum and enumDescriptions in the same edit
- Generate descriptions from the same source as enum values
- Drop enumDescriptions entirely if descriptions are unknown (empty is valid)
When it happens
Trigger: A property p has len(p.EnumDescriptions) > 0 and that count differs from len(p.Enum) — an enum value added/removed without updating descriptions, or vice versa.
Common situations: Adding a new enum value from refreshed upstream metadata without adding a description; deleting a description for an undocumented value; hand-editing either array.
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
- L2: field %q has format: binary but type = %q (want string)
- L2: field %q minimum (%v) >= maximum (%v)
- L2: required key %q in %q not found in its properties
- L1: property %q has invalid type %q
- L1: array property %q missing items
AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04).
Data as JSON: /api/errors/3bf7a3b4b6aafd51.
Report an issue: GitHub.