{"record":{"id":"8233b22e7808a2c2","repo":"larksuite/cli","slug":"svalue-v-is-above-maximum-v","errorCode":null,"errorMessage":"%svalue %v is above maximum %v","messagePattern":"(.+?)value (.+?) is above maximum (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/sheets/flag_schema_validate.go","lineNumber":378,"sourceCode":"\tif value == nil && schema.Nullable {\n\t\treturn\n\t}\n\n\tif schema.Type != \"\" {\n\t\tif !matchesJSONType(value, schema.Type) {\n\t\t\tc.add(&typeMismatchError{path: path, expected: schema.Type, got: jsType(value), enum: schema.Enum, description: schema.Description})\n\t\t\treturn // wrong container type — descending would cascade nonsense.\n\t\t}\n\t}\n\n\t// Numeric bounds — only checked when value is a number (type mismatch\n\t// already reported above). Apply to both `number` and `integer` types.\n\tif num, ok := value.(float64); ok {\n\t\tif schema.Minimum != nil && num < *schema.Minimum {\n\t\t\tc.add(fmt.Errorf(\"%svalue %v is below minimum %v\", pathPrefix(path), num, *schema.Minimum)) //nolint:forbidigo // intermediate error; validateFlagAgainstSchema wraps it into a typed flag validation error with a --print-schema hint\n\t\t}\n\t\tif schema.Maximum != nil && num > *schema.Maximum {\n\t\t\tc.add(fmt.Errorf(\"%svalue %v is above maximum %v\", pathPrefix(path), num, *schema.Maximum)) //nolint:forbidigo // intermediate error; validateFlagAgainstSchema wraps it into a typed flag validation error with a --print-schema hint\n\t\t}\n\t}\n\n\t// Array length bounds — only checked when value is an array.\n\tif arr, ok := value.([]interface{}); ok {\n\t\tif schema.MinItems != nil && len(arr) < *schema.MinItems {\n\t\t\tc.add(fmt.Errorf(\"%sarray has %d items, minimum is %d\", pathPrefix(path), len(arr), *schema.MinItems)) //nolint:forbidigo // intermediate error; validateFlagAgainstSchema wraps it into a typed flag validation error with a --print-schema hint\n\t\t}\n\t\tif schema.MaxItems != nil && len(arr) > *schema.MaxItems {\n\t\t\tc.add(fmt.Errorf(\"%sarray has %d items, maximum is %d\", pathPrefix(path), len(arr), *schema.MaxItems)) //nolint:forbidigo // intermediate error; validateFlagAgainstSchema wraps it into a typed flag validation error with a --print-schema hint\n\t\t}\n\t}\n\n\tif len(schema.Enum) > 0 {\n\t\tmatched := false\n\t\tfor _, allowed := range schema.Enum {\n\t\t\tif jsonEqual(allowed, value) {\n\t\t\t\tmatched = true","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/sheets/flag_schema_validate.go#L360-L396","documentation":"Schema validation error from collectSchemaErrors: a numeric flag value exceeds the JSON-schema `maximum` bound. The validator only applies this when the value is a number; the intermediate error is wrapped by validateFlagAgainstSchema into a typed flag validation error with a --print-schema hint.","triggerScenarios":"Passing a --flag number larger than the schema's declared `maximum`, e.g. a limit/capacity field with `maximum: 5000` receiving 10000.","commonSituations":"Requesting page sizes or batch counts above the API cap; using absolute counts where a bounded range is required; porting values from a different API version with looser limits.","solutions":["Lower the value to at most the schema maximum shown by --print-schema.","Split oversized requests (e.g. chunk a large batch into schema-compliant batches).","Validate/ clamp numeric inputs against the schema bounds before invoking."],"exampleFix":"// before\nlark-cli sheets batch --limit 10000  // maximum is 5000\n// after\nlark-cli sheets batch --limit 5000","handlingStrategy":"validation","validationCode":"const max = 5000; // from schema maximum\nif (typeof value === \"number\" && value > max) {\n  throw new Error(`value must be <= ${max}, got ${value}`);\n}","typeGuard":"function isNumberAtMost(v: unknown, max: number): v is number {\n  return typeof v === \"number\" && Number.isFinite(v) && v <= max;\n}","tryCatchPattern":null,"preventionTips":["Check the API limit via --print-schema and chunk oversized requests.","Keep limits in constants mirroring the schema bounds.","Validate page sizes/batch counts at config load time."],"tags":["sheets","schema-validation","cli"],"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"}