{"record":{"id":"2ca01366e24b7717","repo":"AlistGo/alist","slug":"s-v","errorCode":null,"errorMessage":"%s: %v","messagePattern":"%s: %v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/google_drive/driver.go","lineNumber":156,"sourceCode":"\t\t}).\n\t\tSetError(&e).SetBody(data).SetContext(ctx)\n\tif obj != nil {\n\t\tres, err = req.Patch(url)\n\t} else {\n\t\tres, err = req.Post(url)\n\t}\n\tif err != nil {\n\t\treturn 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 err\n\t\t\t}\n\t\t\treturn d.Put(ctx, dstDir, stream, up)\n\t\t}\n\t\treturn fmt.Errorf(\"%s: %v\", e.Error.Message, e.Error.Errors)\n\t}\n\tputUrl := res.Header().Get(\"location\")\n\tif stream.GetSize() < d.ChunkSize*1024*1024 {\n\t\t_, err = d.request(putUrl, http.MethodPut, func(req *resty.Request) {\n\t\t\treq.SetHeader(\"Content-Length\", strconv.FormatInt(stream.GetSize(), 10)).\n\t\t\t\tSetBody(driver.NewLimitedUploadStream(ctx, stream))\n\t\t}, nil)\n\t} else {\n\t\terr = d.chunkUpload(ctx, stream, putUrl)\n\t}\n\treturn err\n}\n\nvar _ driver.Driver = (*GoogleDrive)(nil)\n","sourceCodeStart":138,"sourceCodeEnd":171,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/google_drive/driver.go#L138-L171","documentation":"Google Drive upload (Put) error: the resumable-upload session creation returned a structured API error with a non-zero code that is not 401. The message is '<Google error message>: <detailed error list>', exposing Drive's reason (e.g. storageQuotaExceeded, teamDrivesFolderNotFound, dailyLimitExceeded).","triggerScenarios":"Initiating an upload where the session-init POST responds with an error JSON: Google account out of storage (storageQuotaExceeded), upload rate limits (userRateLimitExceeded), target folder deleted or inaccessible, or service-account project not approved.","commonSituations":"Free Google account with 15GB full; too many uploads per second per project; shared-drive folder removed after driver init; OAuth app in testing mode hitting 100-user cap or unverified scopes.","solutions":["Match the reason string in the error: storageQuotaExceeded -> free space or switch account; userRateLimitExceeded -> throttle uploads and raise per-user quota in Cloud console","Verify the destination folder exists and the credential has Editor rights on it (service accounts must be granted explicitly, or use impersonation)","For service accounts, check the Google Cloud project's Drive API quota and domain-wide delegation setup","If app is in testing mode, push it to production or add the user as a test user"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isDriveQuotaError(err error) bool {\n  return err != nil && (strings.Contains(err.Error(), \"storageQuotaExceeded\") || strings.Contains(err.Error(), \"userRateLimitExceeded\"))\n}","tryCatchPattern":"err := d.Put(ctx, dstDir, stream, up)\nif err != nil {\n  if strings.Contains(err.Error(), \"storageQuotaExceeded\") { /* stop, notify user */ return err }\n  if strings.Contains(err.Error(), \"RateLimitExceeded\") { /* backoff + retry upload */ }\n}","preventionTips":["Check Drive quota before large uploads","Throttle parallel uploads to stay under per-user rate limits","Keep uploads resumable so retry does not restart from zero"],"tags":["google-drive","upload","quota","api"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}