larksuite/cli · error

%s minimum exceeds maximum

Error message

%s minimum exceeds maximum

What it means

validateShape rejects a typedIntegerShape where both Minimum and Maximum are set and Minimum exceeds Maximum. The empty range cannot match any integer, so the shape declaration fails at command registration with the offending path in the message.

Source

Thrown at shortcuts/common/typed_compile_data.go:272

}

func validateShape(shape typedValueShape, path string) error {
	if shape == nil {
		return fmt.Errorf("%s is nil", path)
	}
	switch value := shape.(type) {
	case anyJSONShape:
	case typedStringShape:
		if value.MinLength != nil && *value.MinLength < 0 || value.MaxLength != nil && *value.MaxLength < 0 {
			return fmt.Errorf("%s string lengths must be nonnegative", path)
		}
		if value.MinLength != nil && value.MaxLength != nil && *value.MinLength > *value.MaxLength {
			return fmt.Errorf("%s minLength exceeds maxLength", path)
		}
	case typedBooleanShape:
	case typedIntegerShape:
		if value.Minimum != nil && value.Maximum != nil && *value.Minimum > *value.Maximum {
			return fmt.Errorf("%s minimum exceeds maximum", path)
		}
	case typedNumberShape:
		for _, number := range append(append([]float64{}, value.Enum...), pointerFloats(value.Minimum, value.Maximum)...) {
			if math.IsNaN(number) || math.IsInf(number, 0) {
				return fmt.Errorf("%s number constraints must be finite", path)
			}
		}
		if value.Minimum != nil && value.Maximum != nil && *value.Minimum > *value.Maximum {
			return fmt.Errorf("%s minimum exceeds maximum", path)
		}
	case typedNullShape:
	case typedConstShape:
		if _, err := json.Marshal(value.Value); err != nil {
			return fmt.Errorf("%s const is not JSON-encodable: %w", path, err)
		}
	case typedArrayShape:
		if value.Items == nil {
			return fmt.Errorf("%s.Items is required", path)

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Read the path prefix to find the integer shape; verify Minimum <= Maximum.
  2. Correct or swap the two values in the shape literal or schema tag.
  3. Drop one bound if a one-sided range is intended.
  4. Cover the shape construction with a test that calls the compile path so the contradiction is caught in CI.

Example fix

// before
typedIntegerShape{Minimum: int64Ptr(100), Maximum: int64Ptr(50)}
// after
typedIntegerShape{Minimum: int64Ptr(50), Maximum: int64Ptr(100)}
Defensive patterns

Strategy: validation

Validate before calling

func validIntegerRange(s typedIntegerShape) bool {
    return s.Minimum == nil || s.Maximum == nil || *s.Minimum <= *s.Maximum
}
// if !validIntegerRange(shape) { return errors.New("minimum exceeds maximum") }

Prevention

When it happens

Trigger: An explicit Output.Data.Shape or DataField.Shape override declares typedIntegerShape with Minimum > Maximum; or the bounds come from a tag lowering (schema:"minimum=...,maximum=...") where the authored numbers are inverted.

Common situations: Typo in authored schema tags; programmatic bounds derived from constants or config that are inconsistent; copy-paste edits that changed one bound but not the other.

Related errors


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/c5db07fb05eaa86e. Report an issue: GitHub.