{"record":{"id":"f7a3af4005f2d984","repo":"larksuite/cli","slug":"minitems-exceeds-maxitems","errorCode":null,"errorMessage":"minItems exceeds maxItems","messagePattern":"minItems exceeds maxItems","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":510,"sourceCode":"\t\t}\n\t}\n\tif result.required == result.optional {\n\t\treturn result, fmt.Errorf(\"schema must declare exactly one of required or optional\")\n\t}\n\tif result.required && result.defaultValue.Set {\n\t\treturn result, fmt.Errorf(\"required input cannot declare default\")\n\t}\n\tif result.nullable != nil && *result.nullable && !isNilCapable(valueType) {\n\t\treturn result, fmt.Errorf(\"nullable requires a nil-capable Go type\")\n\t}\n\tif result.minLength != nil && result.maxLength != nil && *result.minLength > *result.maxLength {\n\t\treturn result, fmt.Errorf(\"minLength exceeds maxLength\")\n\t}\n\tif result.minimum != nil && result.maximum != nil && *result.minimum > *result.maximum {\n\t\treturn result, fmt.Errorf(\"minimum exceeds maximum\")\n\t}\n\tif result.minItems != nil && result.maxItems != nil && *result.minItems > *result.maxItems {\n\t\treturn result, fmt.Errorf(\"minItems exceeds maxItems\")\n\t}\n\treturn result, nil\n}\n\nfunc parseCLITag(raw string) (typedCLIInput, error) {\n\tvar result typedCLIInput\n\tif raw == \"\" {\n\t\treturn result, nil\n\t}\n\tseen := make(map[string]struct{})\n\tfor _, token := range strings.Split(raw, \";\") {\n\t\tkey, value, ok := strings.Cut(token, \"=\")\n\t\tif !ok || value == \"\" || token != strings.TrimSpace(token) {\n\t\t\treturn result, fmt.Errorf(\"invalid cli token %q\", token)\n\t\t}\n\t\tif _, duplicate := seen[key]; duplicate {\n\t\t\treturn result, fmt.Errorf(\"cli token %q is duplicated\", key)\n\t\t}","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L492-L528","documentation":"When both `minItems` and `maxItems` are declared for a slice/array input, the minimum item count must not exceed the maximum. An inverted range is unsatisfiable, so parseSchemaTag rejects it at compile time.","triggerScenarios":"A tag like schema:\"required;minItems=5;maxItems=2\" on a slice-typed input field.","commonSituations":"Writing bounds in reverse order, or tightening minItems during a schema change without checking maxItems.","solutions":["Ensure minItems <= maxItems in the tag.","Swap the values if inverted.","Drop one bound if only a single limit applies."],"exampleFix":"// before\nIDs []string `schema:\"required;minItems=5;maxItems=2\"`\n// after\nIDs []string `schema:\"required;minItems=2;maxItems=5\"`","handlingStrategy":"validation","validationCode":"func itemsRangeOK(min, max *int) bool {\n\treturn min == nil || max == nil || *min <= *max\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep minItems <= maxItems whenever both are declared.","Mirror the same range discipline used for minLength/maxLength.","Cover slice-typed inputs with a compile-time tag test."],"tags":["go","struct-tags","schema-validation","bounds"],"backgroundTag":"schema-validation-failed","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"}