larksuite/cli · error

integer field has incompatible schema constraint

Error message

integer field has incompatible schema constraint

What it means

Compile-time guard in shapeForType: an integer field declares string constraints, item constraints, or a format, none of which apply to integer types.

Source

Thrown at shortcuts/common/typed_compile_data.go:120

			}
			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")
		}
		shape = numberShape
	case reflect.Slice, reflect.Array:
		if baseType == jsonRawMessageType {
			return nil, fmt.Errorf("json.RawMessage requires an explicit Shape")

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Remove string/item/format-style constraints from the integer field
Defensive patterns

Strategy: validation

When it happens

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