{"record":{"id":"959a4be9a13e881a","repo":"larksuite/cli","slug":"s-must-be-at-least-d","errorCode":null,"errorMessage":"%s must be at least %d","messagePattern":"(.+?) must be at least (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/common/typed_binder.go","lineNumber":444,"sourceCode":"\t\t\treturn fmt.Errorf(\"%s must be one of: %s\", path, strings.Join(constraint.Enum, \", \"))\n\t\t}\n\t\treturn nil\n\tcase typedBooleanShape:\n\t\tboolean, ok := value.(bool)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a boolean\", path)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, boolean) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported boolean value\", path)\n\t\t}\n\t\treturn nil\n\tcase typedIntegerShape:\n\t\tnumber, ok := validationInteger(value)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be an integer\", path)\n\t\t}\n\t\tif constraint.Minimum != nil && number < *constraint.Minimum {\n\t\t\treturn fmt.Errorf(\"%s must be at least %d\", path, *constraint.Minimum)\n\t\t}\n\t\tif constraint.Maximum != nil && number > *constraint.Maximum {\n\t\t\treturn fmt.Errorf(\"%s must be at most %d\", path, *constraint.Maximum)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported integer value\", path)\n\t\t}\n\t\treturn nil\n\tcase typedNumberShape:\n\t\tnumber, ok := validationNumber(value)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"%s must be a number\", path)\n\t\t}\n\t\tif len(constraint.Enum) > 0 && !slices.Contains(constraint.Enum, number) {\n\t\t\treturn fmt.Errorf(\"%s has an unsupported number value\", path)\n\t\t}\n\t\tif constraint.Minimum != nil && number < *constraint.Minimum {\n\t\t\treturn fmt.Errorf(\"%s must be at least %v\", path, *constraint.Minimum)","sourceCodeStart":426,"sourceCodeEnd":462,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/common/typed_binder.go#L426-L462","documentation":"The integer value is valid but falls below the schema's minimum (constraint.Minimum). validateJSONValueAgainstShape compares the decoded number against the declared bound and refuses out-of-range input before the API call. The message names the field path and the required minimum.","triggerScenarios":"Passing a value smaller than the field's declared minimum (e.g. page_size=0 where min is 1; a negative count); computed values that can hit zero/negative under edge cases.","commonSituations":"Default/empty variables (0 or -1 placeholders) flowing into requests; off-by-one in pagination code; business rules where the API requires at least 1 item or 1 unit.","solutions":["Raise the value to at least the minimum shown in the error message","Clamp or validate the value before the call: if v < min { v = min }","Fix the computation that produced the too-small value (e.g. use max(1, n))","Check `schema` for the exact bound if the message context is unclear"],"exampleFix":"// before\npageSize := userPageSize // can be 0\n// after\nif pageSize < 1 {\n    pageSize = 1\n}","handlingStrategy":"validation","validationCode":"func clampMin(v int, min int) int {\n    if v < min {\n        return min\n    }\n    return v\n} // call as clampMin(pageSize, 1) after reading the bound from `schema`","typeGuard":"func isWithinMin(v int, min int) bool { return v >= min }","tryCatchPattern":"if err := bind(field, n); err != nil {\n    var minErr *RangeError\n    if strings.Contains(err.Error(), \"must be at least\") {\n        return fmt.Errorf(\"field %s below minimum: %w\", field, err)\n    }\n    return err\n}","preventionTips":["Clamp numeric inputs to schema bounds at the entry point of your script","Replace placeholder defaults (0, -1) with the schema minimum","Check `schema` for min/max when introducing a new field into automation","Add tests covering boundary values (min-1, min, max, max+1)"],"tags":["validation","cli","range-check","integer"],"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-12T12:17:11.808Z"}