{"record":{"id":"c75d3d906a008c54","repo":"larksuite/cli","slug":"minlength-exceeds-maxlength","errorCode":null,"errorMessage":"minLength exceeds maxLength","messagePattern":"minLength exceeds maxLength","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":504,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema maxItems: %w\", err)\n\t\t\t}\n\t\t\tresult.maxItems = &v\n\t\tdefault:\n\t\t\treturn result, fmt.Errorf(\"unknown schema token %q\", key)\n\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, \"=\")","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L486-L522","documentation":"When both `minLength` and `maxLength` are declared in a schema tag, the minimum must not exceed the maximum; otherwise the constraint set is unsatisfiable and no value could ever validate. parseSchemaTag rejects this contradiction at compile time.","triggerScenarios":"A tag like schema:\"required;minLength=10;maxLength=5\" on a string-typed input field.","commonSituations":"Swapping the two values when writing the tag, or independently tightening minLength / loosening maxLength during refactors without cross-checking.","solutions":["Ensure minLength <= maxLength in the tag.","Swap the values if they were written in the wrong order.","Relax one bound so the range is non-empty."],"exampleFix":"// before\nCode string `schema:\"required;minLength=10;maxLength=5\"`\n// after\nCode string `schema:\"required;minLength=5;maxLength=10\"`","handlingStrategy":"validation","validationCode":"func lengthRangeOK(min, max *int) bool {\n\treturn min == nil || max == nil || *min <= *max\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write bounds as a contiguous range and re-read the tag before committing.","Change both ends of a range together.","Cover every input struct with a compile test so invalid ranges fail CI."],"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"}