{"record":{"id":"6e319311447e4479","repo":"AlistGo/alist","slug":"s-v-6e3193","errorCode":null,"errorMessage":"%s: %v","messagePattern":"%s: %v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/google_drive/util.go","lineNumber":178,"sourceCode":"\t}\n\tif resp != nil {\n\t\treq.SetResult(resp)\n\t}\n\tvar e Error\n\treq.SetError(&e)\n\tres, err := req.Execute(method, url)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif e.Error.Code != 0 {\n\t\tif e.Error.Code == 401 {\n\t\t\terr = d.refreshToken()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn d.request(url, method, callback, resp)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s: %v\", e.Error.Message, e.Error.Errors)\n\t}\n\treturn res.Body(), nil\n}\n\nfunc (d *GoogleDrive) getFiles(id string) ([]File, error) {\n\tpageToken := \"first\"\n\tres := make([]File, 0)\n\tfor pageToken != \"\" {\n\t\tif pageToken == \"first\" {\n\t\t\tpageToken = \"\"\n\t\t}\n\t\tvar resp Files\n\t\torderBy := \"folder,name,modifiedTime desc\"\n\t\tif d.OrderBy != \"\" {\n\t\t\torderBy = d.OrderBy + \" \" + d.OrderDirection\n\t\t}\n\t\tquery := map[string]string{\n\t\t\t\"orderBy\":  orderBy,","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/google_drive/util.go#L160-L196","documentation":"Generic Google Drive API request error: the response parsed as a Drive error object with non-zero code that is not 401, returned as '<message>: <errors>'. It covers every GET/LIST/DELETE/metadata call made through d.request, exposing reasons like fileNotFound, insufficientFilePermissions, dailyLimitExceeded.","triggerScenarios":"Any Drive API call through request() failing with a structured error: listing a deleted folder, reading a file the credential lacks scope for, per-user or per-project quota exhaustion, shared-drive member removed.","commonSituations":"Stale listing caches referencing deleted files; service account not shared on the target drive; API quota exhausted by aggressive polling; user revoked consent partially.","solutions":["Identify the reason field in '<errors>' and act: fileNotFound -> refresh listing; quota -> raise limits or throttle; insufficientFilePermissions -> share the resource with the service account address","Verify the credential's scopes cover the operation (drive vs drive.readonly vs drive.file)","Add exponential backoff for 403 rate-limit reasons instead of hammering retries","For shared drives, confirm supportsAllDrives membership of the credential"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"func isDriveRetryable(err error) bool {\n  if err == nil { return false }\n  s := err.Error()\n  return strings.Contains(s, \"userRateLimitExceeded\") || strings.Contains(s, \"dailyLimitExceeded\") || strings.Contains(s, \"RateLimitExceeded\")\n}","tryCatchPattern":"body, err := d.request(url, method, cb, resp)\nif err != nil {\n  if isDriveRetryable(err) { /* exponential backoff honoring Retry-After */ }\n  if strings.Contains(err.Error(), \"File not found\") { /* invalidate cache, skip */ }\n}","preventionTips":["Add jittered backoff around Drive calls to dodge per-user limits","Cache list results so deleted files do not trigger 404 loops"],"tags":["google-drive","api","quota","permissions"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}