IceWhaleTech/CasaOS · error
%s: %v
Error message
%s: %v
What it means
During a Google Drive upload (Put), the resumable-session initiation or a follow-up call returned an error body with a non-zero code other than 401; the driver formats the API's message and Errors details as '%s: %v'. The 401 branch refreshes the token and re-enters Put; all other codes fail with this message.
Source
Thrown at drivers/google_drive/drive.go:173
}).
SetError(&e).SetBody(data).SetContext(ctx)
if obj != nil {
res, err = req.Patch(url)
} else {
res, err = req.Post(url)
}
if err != nil {
return err
}
if e.Error.Code != 0 {
if e.Error.Code == 401 {
err = d.refreshToken()
if err != nil {
return err
}
return d.Put(ctx, dstDir, stream, up)
}
return fmt.Errorf("%s: %v", e.Error.Message, e.Error.Errors)
}
putUrl := res.Header().Get("location")
if stream.GetSize() < d.ChunkSize*1024*1024 {
_, err = d.request(putUrl, http.MethodPut, func(req *resty.Request) {
req.SetHeader("Content-Length", strconv.FormatInt(stream.GetSize(), 10)).SetBody(stream.GetReadCloser())
}, nil)
} else {
err = d.chunkUpload(ctx, stream, putUrl)
}
return err
}
var _ driver.Driver = (*GoogleDrive)(nil)
View on GitHub (pinned to 0d3b2f444e)
Solutions
- Match the message/errors against the Google Drive API error table — the reason string (e.g. 'storageQuotaExceeded', 'notFound') names the fix.
- Check account storage at https://one.google.com/storage and free space or upgrade if quota is exceeded.
- Verify the OAuth scopes granted to the token include drive scope; re-authorize after changing scopes.
- For large files, ensure chunk uploads are contiguous and the session is completed within its validity.
Defensive patterns
Strategy: try-catch
Try / catch
err := d.Put(ctx, dstDir, stream, up)
if err != nil {
msg := err.Error()
switch {
case strings.Contains(msg, "storageQuotaExceeded"):
return errors.New("Google Drive storage is full; free space and retry")
case strings.Contains(msg, "notFound"):
return refreshParentAndRetry()
}
return err
} Prevention
- Check available quota before large uploads
- Keep resumable sessions short-lived and complete chunks contiguously
- Re-authorize whenever Drive scopes change in the consent screen
When it happens
Trigger: Initiating a resumable upload or PUT-ing bytes when storage quota is exceeded (403 storageQuotaExceeded), the parent folder is gone (404), permission scopes are insufficient, the file exceeds Google Drive size limits, or the upload session timed out.
Common situations: Google account out of storage; OAuth consent missing Drive scope after an app-scope change; uploading to a shared folder the token's account cannot write; resuming a session URL that expired (must restart within ~1 week, chunk gaps).
Related errors
AI-assisted analysis of IceWhaleTech/CasaOS@0d3b2f444e (2026-08-15).
Data as JSON: /api/errors/8b31b2ac6384deab.
Report an issue: GitHub.