{"record":{"id":"a75585752c4bc9c1","repo":"larksuite/cli","slug":"schema-maxitems-w","errorCode":null,"errorMessage":"schema maxItems: %w","messagePattern":"schema maxItems: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_compile_args.go","lineNumber":487,"sourceCode":"\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}\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}","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_compile_args.go#L469-L505","documentation":"parseSchemaTag validates each `schema` struct tag token on typed shortcut argument fields. The `maxItems` token must be a non-negative integer; if parseNonnegativeInt rejects the value, the underlying error is wrapped with the \"schema maxItems: \" prefix and compilation of the field fails.","triggerScenarios":"A field tag such as `schema:\"optional;maxItems=ten\"`, `maxItems=` (empty value), `maxItems=-5`, or a value that overflows the integer parser, encountered while compiling a shortcut input struct.","commonSituations":"Typos or accidental units in the tag (e.g. \"maxItems=10 items\"), negative limits copied from other configs, or malformed tags after manual editing.","solutions":["Use a plain non-negative integer for maxItems, e.g. schema:\"optional;maxItems=100\".","Ensure there are no spaces or units inside the tag value.","Drop the maxItems token if no upper bound is required."],"exampleFix":"// before\nTags []string `schema:\"optional;maxItems=0x10\"`\n// after\nTags []string `schema:\"optional;maxItems=16\"`","handlingStrategy":"validation","validationCode":"func validMaxItems(tag string) bool {\n\tfor _, tok := range strings.Split(tag, \";\") {\n\t\tif k, v, ok := strings.Cut(tok, \"=\"); ok && k == \"maxItems\" {\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":["Use decimal integers only; no units or hex.","Keep maxItems >= minItems when both are present.","Add a unit test compiling every shortcut input struct to catch bad tags early."],"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"}