{"record":{"id":"508dbc70a8c1510f","repo":"larksuite/cli","slug":"schema-minitems-w","errorCode":null,"errorMessage":"schema minItems: %w","messagePattern":"schema minItems: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":481,"sourceCode":"\t\t\t\treturn result, fmt.Errorf(\"schema maxLength: %w\", err)\n\t\t\t}\n\t\t\tresult.maxLength = &v\n\t\tcase \"minimum\":\n\t\t\tv, err := parseFiniteFloat(value)\n\t\t\tif err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema minimum: %w\", err)\n\t\t\t}\n\t\t\tresult.minimum = &v\n\t\tcase \"maximum\":\n\t\t\tv, err := parseFiniteFloat(value)\n\t\t\tif err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema maximum: %w\", err)\n\t\t\t}\n\t\t\tresult.maximum = &v\n\t\tcase \"minItems\":\n\t\t\tv, err := parseNonnegativeInt(value)\n\t\t\tif err != nil {\n\t\t\t\treturn result, fmt.Errorf(\"schema minItems: %w\", err)\n\t\t\t}\n\t\t\tresult.minItems = &v\n\t\tcase \"maxItems\":\n\t\t\tv, err := parseNonnegativeInt(value)\n\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}","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L463-L499","documentation":"parseSchemaTag validates each `schema` struct tag token on typed shortcut argument fields. The `minItems` token requires a non-negative integer; when parseNonnegativeInt fails (missing value, non-numeric, negative, or out-of-range), the parser wraps that error with this prefix and aborts schema compilation for the field.","triggerScenarios":"Declaring a struct field tag like `schema:\"required;minItems=abc\"`, `minItems=` (empty), `minItems=-1`, or an oversized number, on a field collected via collectArgFields/compileStructShape.","commonSituations":"Typos in the tag (letters, stray spaces inside the value), copy-pasted negative bounds, or hand-written tags edited after a refactor.","solutions":["Set minItems to a plain non-negative integer, e.g. schema:\"required;minItems=1\".","Remove leading/trailing spaces around the value inside the tag.","If no minimum is needed, delete the minItems token entirely."],"exampleFix":"// before\nQuery []string `schema:\"required;minItems=-1\"`\n// after\nQuery []string `schema:\"required;minItems=1\"`","handlingStrategy":"validation","validationCode":"func validMinItems(tag string) bool {\n\tfor _, tok := range strings.Split(tag, \";\") {\n\t\tif k, v, ok := strings.Cut(tok, \"=\"); ok && k == \"minItems\" {\n\t\t\tn, err := strconv.Atoi(v)\n\t\t\treturn err == nil && n >= 0\n\t\t}\n\t}\n\treturn true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use plain non-negative integers for minItems.","Run the test suite; parseSchemaTag errors surface in compile-time shortcut tests.","Never embed spaces inside tag values."],"tags":["go","struct-tags","schema-validation","compile-time"],"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"}