{"record":{"id":"7cda916acc191a2f","repo":"IceWhaleTech/CasaOS","slug":"s-v-7cda91","errorCode":null,"errorMessage":"%s: %v","messagePattern":"%s: %v","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/google_drive/util.go","lineNumber":96,"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":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/IceWhaleTech/CasaOS/blob/0d3b2f444ec0193193cf03eef6d43c6e35b0183e/drivers/google_drive/util.go#L78-L114","documentation":"A Google Drive API call returned an error body with a non-zero code other than 401; the driver formats the endpoint's message and Errors details as '%s: %v'. The 401 branch refreshes the access token and retries the request once; every other error code surfaces here.","triggerScenarios":"Any Drive v3 request (list, get, create, patch, delete) that fails post-authentication: 404 file not found, 403 insufficientFilePermissions or dailyLimitExceeded, 400 invalid query syntax in the list 'q' parameter.","commonSituations":"Operating on a file deleted from Drive (including items in trash purged); shared-drive item where includeItemsFromAllDrives needs the right scope; malformed search queries; hitting the per-user 1000 req/100s quota.","solutions":["Read the Errors details — Google returns a 'reason' (notFound, insufficientFilePermissions, dailyLimitExceeded) that identifies the exact fix.","For 404: re-list the parent folder; the ID may be stale.","For quota: back off exponentially and reduce concurrent requests.","For permission reasons: re-authorize with the required Drive scopes or request access to the shared drive."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"_, err := d.request(url, method, cb, resp)\nif err != nil {\n\tmsg := err.Error()\n\tif strings.Contains(msg, \"dailyLimitExceeded\") || strings.Contains(msg, \"userRateLimitExceeded\") {\n\t\ttime.Sleep(backoff) // 429-class: retry later\n\t\treturn d.request(url, method, cb, resp)\n\t}\n\treturn err // 404/403 permanent: refresh listing or scopes\n}","preventionTips":["Re-list folders before acting on cached file IDs","Include Errors[].Reason in wrapped errors for precise branching","Batch Drive requests and cap concurrency to stay under quotas"],"tags":["google-drive","api-error","http","driver"],"backgroundTag":null,"analyzedSha":"0d3b2f444ec0193193cf03eef6d43c6e35b0183e","analyzedAt":"2026-08-15T13:27:57.821Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}