gildas-lormeau/SingleFile · error · Error

error.message + " (Dropbox)"

Error message

error.message + " (Dropbox)"

What it means

In saveToDropbox, when refreshing the Dropbox OAuth token fails with any message other than "unknown_token", the error is rethrown with an " (Dropbox)" suffix and the original as cause. It signals a non-recoverable Dropbox token refresh failure.

Source

Thrown at src/core/bg/downloads.js:574

async function saveToDropbox(taskId, filename, blob, uploadOptions) {
	try {
		await getDropboxAuthInfo();
		const taskInfo = business.getTaskInfo(taskId);
		if (!taskInfo || !taskInfo.cancelled) {
			return await dropbox.upload(filename, blob, uploadOptions, callback => business.setCancelCallback(taskId, callback));
		}
	}
	catch (error) {
		if (error.message == "invalid_token") {
			let authInfo;
			try {
				authInfo = await dropbox.refreshAuthToken();
			} catch (error) {
				if (error.message == "unknown_token") {
					authInfo = await getDropboxAuthInfo(true);
				} else {
					throw new Error(error.message + " (Dropbox)", { cause: error });
				}
			}
			if (authInfo) {
				await config.setDropboxAuthInfo(authInfo);
			} else {
				await config.removeDropboxAuthInfo();
			}
			return await saveToDropbox(taskId, filename, blob, uploadOptions);
		} else {
			throw new Error(error.message + " (Dropbox)", { cause: error });
		}
	}
}

async function testSkipSave(filename, options) {
	let skipped, filenameConflictAction = options.filenameConflictAction;
	if (filenameConflictAction == CONFLICT_ACTION_SKIP) {
		const downloadItems = await browser.downloads.search({

View on GitHub (pinned to 517fb7c5cf)

Solutions

  1. Reconnect Dropbox in SingleFile options to get fresh auth tokens
  2. Check error.cause for the OAuth error code (invalid_grant means re-consent required)
  3. Verify system clock accuracy
  4. Check https://www.dropbox.com/account/connected_apps and revoke/re-add if stale
Defensive patterns

Strategy: try-catch

Validate before calling

// verify stored Dropbox auth before saving
const authInfo = await config.getDropboxAuthInfo();
if (!authInfo || !authInfo.refreshToken) {
  await getDropboxAuthInfo(true); // force interactive re-auth
}

Try / catch

try {
  await saveToDropbox(taskId, filename, blob, uploadOptions);
} catch (error) {
  if (error.message.endsWith('(Dropbox)') && String(error.cause).includes('invalid_grant')) {
    await getDropboxAuthInfo(true); // force re-consent
  } else { throw error; }
}

Prevention

When it happens

Trigger: dropbox.refreshAuthToken() rejects during saveToDropbox (called from downloadContent/downloadCompressedContent) with errors like 'invalid_grant'; only 'unknown_token' triggers re-auth.

Common situations: User disconnected SingleFile from Dropbox app connections; refresh token expired; Dropbox app credentials changed; Dropbox API outage.

Related errors


AI-assisted analysis of gildas-lormeau/SingleFile@517fb7c5cf (2026-09-01). Data as JSON: /api/errors/5d4f42ace38dd0ec. Report an issue: GitHub.