larksuite/cli · error

enum value %q is not boolean

Error message

enum value %q is not boolean

What it means

Compile-time guard in shapeForType: an enum entry on a boolean field is not parseable as true/false, so it cannot populate the boolean shape's allowed values.

Source

Thrown at shortcuts/common/typed_compile_data.go:85

func shapeForType(t reflect.Type, schema schemaTag, input bool, active map[reflect.Type]struct{}) (typedValueShape, error) {
	baseType := t
	for baseType.Kind() == reflect.Pointer {
		baseType = baseType.Elem()
	}
	var shape typedValueShape
	switch baseType.Kind() {
	case reflect.String:
		stringShape := typedStringShape{Format: schema.format, MinLength: schema.minLength, MaxLength: schema.maxLength}
		for _, raw := range schema.enum {
			stringShape.Enum = append(stringShape.Enum, raw)
		}
		shape = stringShape
	case reflect.Bool:
		booleanShape := typedBooleanShape{}
		for _, raw := range schema.enum {
			v, err := parseBool(raw)
			if err != nil {
				return nil, fmt.Errorf("enum value %q is not boolean", raw)
			}
			booleanShape.Enum = append(booleanShape.Enum, v)
		}
		if hasStringConstraints(schema) || hasNumberConstraints(schema) || hasItemConstraints(schema) {
			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

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Write bool enum values as true|false
Defensive patterns

Strategy: validation

When it happens

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