{"record":{"id":"d9a3029d16187212","repo":"vitessio/vitess","slug":"detailed-limit-v-exceeds-maximum-allowed-value-v","errorCode":null,"errorMessage":"detailed_limit %v exceeds maximum allowed value %v","messagePattern":"detailed_limit (.+?) exceeds maximum allowed value (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":1562,"sourceCode":"\tbhs, err := bs.ListBackups(ctx, bucket)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttotalBackups := len(bhs)\n\tif req.Limit > 0 {\n\t\tif req.Limit > maxBackupLimit {\n\t\t\treturn nil, fmt.Errorf(\"limit %v exceeds maximum allowed value %v\", req.Limit, maxBackupLimit)\n\t\t}\n\t\tif int(req.Limit) < totalBackups {\n\t\t\ttotalBackups = int(req.Limit)\n\t\t}\n\t}\n\n\ttotalDetailedBackups := len(bhs)\n\tif req.DetailedLimit > 0 {\n\t\tif req.DetailedLimit > maxBackupLimit {\n\t\t\treturn nil, fmt.Errorf(\"detailed_limit %v exceeds maximum allowed value %v\", req.DetailedLimit, maxBackupLimit)\n\t\t}\n\t\tif int(req.DetailedLimit) < totalDetailedBackups {\n\t\t\ttotalDetailedBackups = int(req.DetailedLimit)\n\t\t}\n\t}\n\n\tbackups := make([]*mysqlctlpb.BackupInfo, 0, totalBackups)\n\tbackupsToSkip := len(bhs) - totalBackups\n\tbackupsToSkipDetails := len(bhs) - totalDetailedBackups\n\n\tfor i, bh := range bhs {\n\t\tif i < backupsToSkip {\n\t\t\tcontinue\n\t\t}\n\n\t\tbi := mysqlctlproto.BackupHandleToProto(bh)\n\t\tbi.Keyspace = req.Keyspace\n\t\tbi.Shard = req.Shard","sourceCodeStart":1544,"sourceCodeEnd":1580,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L1544-L1580","documentation":"Analogous to the Limit check, GetBackups validates req.DetailedLimit (used when returning detailed backup metadata) against maxBackupLimit. Values above the cap are rejected before computing detailed backup info.","triggerScenarios":"Calling GetBackups with DetailedLanguage/DetailedLimit set to a value greater than maxBackupLimit when detailed backup metadata is requested.","commonSituations":"Same as the Limit case: sentinel MaxInt values from generic pagination code, or clients unaware of the server-side cap.","solutions":["Lower DetailedLimit to at most maxBackupLimit","Omit DetailedLimit (<= 0) when full detail is not needed","Page through detailed results in multiple calls if more detail is required"],"exampleFix":"// before\nreq.DetailedLimit = math.MaxInt32\n// after\nreq.DetailedLimit = 1000","handlingStrategy":"validation","validationCode":"const maxBackupLimit = 10000\nif req.DetailedLimit > 0 && req.DetailedLimit > maxBackupLimit {\n    return fmt.Errorf(\"detailed_limit %d exceeds cap\", req.DetailedLimit)\n}","typeGuard":null,"tryCatchPattern":"_, err := client.GetBackups(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"detailed_limit\") {\n    req.DetailedLimit = 0 // or a value within the cap\n}","preventionTips":["Clamp DetailedLimit to the server-side maxBackupLimit","Avoid MaxInt sentinels from generic pagination helpers","Page detailed requests instead of one giant call","Review the cap constant when bumping Vitess versions"],"tags":["vitess","backup","validation","pagination"],"backgroundTag":"limit-exceeds-maximum","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}