gildas-lormeau/SingleFile · error · Error
error.message + " (Google Drive)"
Error message
error.message + " (Google Drive)"
What it means
In saveToGDrive, when refreshing the Google OAuth token fails with any message other than "unknown_token", the error is rethrown with an " (Google Drive)" suffix and the original as cause. It means Google Drive token refresh failed for a non-recoverable reason.
Source
Thrown at src/core/bg/downloads.js:542
async function saveToGDrive(taskId, filename, blob, authOptions, uploadOptions) {
try {
await getAuthInfo(authOptions);
const taskInfo = business.getTaskInfo(taskId);
if (!taskInfo || !taskInfo.cancelled) {
return await gDrive.upload(filename, blob, uploadOptions, callback => business.setCancelCallback(taskId, callback));
}
}
catch (error) {
if (error.message == "invalid_token") {
let authInfo;
try {
authInfo = await gDrive.refreshAuthToken();
} catch (error) {
if (error.message == "unknown_token") {
authInfo = await getAuthInfo(authOptions, true);
} else {
throw new Error(error.message + " (Google Drive)", { cause: error });
}
}
if (authInfo) {
await config.setAuthInfo(authInfo);
} else {
await config.removeAuthInfo();
}
return await saveToGDrive(taskId, filename, blob, authOptions, uploadOptions);
} else {
throw new Error(error.message + " (Google Drive)", { cause: error });
}
}
}
async function saveToDropbox(taskId, filename, blob, uploadOptions) {
try {
await getDropboxAuthInfo();
const taskInfo = business.getTaskInfo(taskId);View on GitHub (pinned to 517fb7c5cf)
Solutions
- Re-authorize Google Drive access in SingleFile options to obtain fresh tokens
- Check error.cause: 'invalid_grant' means the refresh token is dead and re-consent is required
- Verify the system clock is accurate (token validation is time-sensitive)
- Check Google Cloud OAuth client config if you self-hosted the credentials
Defensive patterns
Strategy: try-catch
Validate before calling
// verify stored auth before saving
const authInfo = await config.getAuthInfo();
if (!authInfo || !authInfo.refreshToken) {
await getAuthInfo(authOptions, true); // force interactive re-auth
} Try / catch
try {
await saveToGDrive(taskId, filename, blob, authOptions, uploadOptions);
} catch (error) {
if (error.message.endsWith('(Google Drive)') && String(error.cause).includes('invalid_grant')) {
await getAuthInfo(authOptions, true); // force re-consent
} else { throw error; }
} Prevention
- Re-authorize the Google account periodically to keep the refresh token alive
- Do not revoke the app in Google security settings
- Keep system clock synchronized
- Treat 'invalid_grant' in error.cause as a signal to re-consent, not retry
When it happens
Trigger: gDrive.refreshAuthToken() rejects with e.g. 'invalid_grant' during saveToGDrive called from downloadContent/downloadCompressedContent; only 'unknown_token' is handled by re-auth, everything else is rethrown.
Common situations: User revoked the app in Google account settings; refresh token expired after 6 months of inactivity or password change; OAuth client credentials changed; Google API quota or server outage.
Related errors
- error.message + " (Dropbox)"
- unknown_token
- error.message + " (GitHub)"
- error.message + " (S3)"
- error.message + " (WebDAV)"
AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01).
Data as JSON: /api/errors/916050d9b3098101.
Report an issue: GitHub.