{"record":{"id":"c5db07fb05eaa86e","repo":"larksuite/cli","slug":"s-minimum-exceeds-maximum","errorCode":null,"errorMessage":"%s minimum exceeds maximum","messagePattern":"(.+?) minimum exceeds maximum","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_data.go","lineNumber":272,"sourceCode":"}\n\nfunc validateShape(shape typedValueShape, path string) error {\n\tif shape == nil {\n\t\treturn fmt.Errorf(\"%s is nil\", path)\n\t}\n\tswitch value := shape.(type) {\n\tcase anyJSONShape:\n\tcase typedStringShape:\n\t\tif value.MinLength != nil && *value.MinLength < 0 || value.MaxLength != nil && *value.MaxLength < 0 {\n\t\t\treturn fmt.Errorf(\"%s string lengths must be nonnegative\", path)\n\t\t}\n\t\tif value.MinLength != nil && value.MaxLength != nil && *value.MinLength > *value.MaxLength {\n\t\t\treturn fmt.Errorf(\"%s minLength exceeds maxLength\", path)\n\t\t}\n\tcase typedBooleanShape:\n\tcase typedIntegerShape:\n\t\tif value.Minimum != nil && value.Maximum != nil && *value.Minimum > *value.Maximum {\n\t\t\treturn fmt.Errorf(\"%s minimum exceeds maximum\", path)\n\t\t}\n\tcase typedNumberShape:\n\t\tfor _, number := range append(append([]float64{}, value.Enum...), pointerFloats(value.Minimum, value.Maximum)...) {\n\t\t\tif math.IsNaN(number) || math.IsInf(number, 0) {\n\t\t\t\treturn fmt.Errorf(\"%s number constraints must be finite\", path)\n\t\t\t}\n\t\t}\n\t\tif value.Minimum != nil && value.Maximum != nil && *value.Minimum > *value.Maximum {\n\t\t\treturn fmt.Errorf(\"%s minimum exceeds maximum\", path)\n\t\t}\n\tcase typedNullShape:\n\tcase typedConstShape:\n\t\tif _, err := json.Marshal(value.Value); err != nil {\n\t\t\treturn fmt.Errorf(\"%s const is not JSON-encodable: %w\", path, err)\n\t\t}\n\tcase typedArrayShape:\n\t\tif value.Items == nil {\n\t\t\treturn fmt.Errorf(\"%s.Items is required\", path)","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_data.go#L254-L290","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the path prefix to find the integer shape; verify Minimum <= Maximum.","Correct or swap the two values in the shape literal or schema tag.","Drop one bound if a one-sided range is intended.","Cover the shape construction with a test that calls the compile path so the contradiction is caught in CI."],"exampleFix":"// before\ntypedIntegerShape{Minimum: int64Ptr(100), Maximum: int64Ptr(50)}\n// after\ntypedIntegerShape{Minimum: int64Ptr(50), Maximum: int64Ptr(100)}","handlingStrategy":"validation","validationCode":"func validIntegerRange(s typedIntegerShape) bool {\n    return s.Minimum == nil || s.Maximum == nil || *s.Minimum <= *s.Maximum\n}\n// if !validIntegerRange(shape) { return errors.New(\"minimum exceeds maximum\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Author minimum/maximum pairs in schema tags together and keep them ordered.","Derive ranges from named constants reviewed as a pair, not independent literals.","Cover the shape in a compile-path unit test."],"tags":["go","schema","validation","integer-constraints"],"backgroundTag":"invalid-schema-constraint","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}