larksuite/cli · error

enum value %q is not a finite number

Error message

enum value %q is not a finite number

What it means

Compile-time guard in shapeForType: an enum entry on a float field is not a finite number parseable at the field's bit width.

Source

Thrown at shortcuts/common/typed_compile_data.go:128

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

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Use finite numeric enum values within float32/float64 range
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/common/typed_compile_data.go:128 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/236b5455aedc20db. Report an issue: GitHub.