larksuite/cli · error

enum value is not integer

Error message

enum value %q is not integer

What it means

Compile-time guard in shapeForType: an enum entry on an integer field cannot be parsed as an integer of the field's bit width.

Solutions

  1. Use integer enum values within the field type's range
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/common/typed_compile_data.go:115 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/9ac9798d25024e16. Report an issue: GitHub.

Appendix: source

Thrown at shortcuts/common/typed_compile_data.go:115

		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())
			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")

View on GitHub (pinned to 7fd6ef3c07)