gildas-lormeau/SingleFile · warning · Error

upload_cancelled

upload_cancelled

Error message

upload_cancelled

What it means

In downloadContent, after asking the page's content script (via messaging) to collect/prepare the page data for upload/processing, a null/absent response throws Error('upload_cancelled'). It means the foreground upload step did not return a result — typically the user closed the infobar/cancelled, or the content script did not answer.

Source

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

					message.url = URL.createObjectURL(new Blob(contents, { type: message.mimeType }));
				}
				response = await downloadPage(message, {
					confirmFilename: message.confirmFilename,
					incognito,
					filenameConflictAction: message.filenameConflictAction,
					filenameReplacementCharacter: message.filenameReplacementCharacter,
					bookmarkId: message.bookmarkId,
					replaceBookmarkURL: message.replaceBookmarkURL,
					includeInfobar: message.includeInfobar,
					openInfobar: message.openInfobar,
					infobarPositionAbsolute: message.infobarPositionAbsolute,
					infobarPositionTop: message.infobarPositionTop,
					infobarPositionBottom: message.infobarPositionBottom,
					infobarPositionLeft: message.infobarPositionLeft,
					infobarPositionRight: message.infobarPositionRight
				});
				if (!response) {
					throw new Error("upload_cancelled");
				}
			}
			if (message.bookmarkId && message.replaceBookmarkURL && response && response.url) {
				await bookmarks.update(message.bookmarkId, { url: response.url });
			}
			ui.onEnd(tabId);
			if (message.openSavedPage && !message.openEditor) {
				const createTabProperties = { active: true, url: "/src/ui/pages/viewer.html?blobURI=" + URL.createObjectURL(new Blob(contents, { type: message.mimeType })), windowId: tab.windowId };
				if (tab.index != null) {
					createTabProperties.index = tab.index + 1;
				}
				browser.tabs.create(createTabProperties);
			}
		}
	} catch (error) {
		if (!error.message || error.message != "upload_cancelled") {
			console.error(error); // eslint-disable-line no-console
			ui.onError(tabId, error.message, error.link);

View on GitHub (pinned to 517fb7c5cf)

Solutions

  1. Treat it as an intentional cancellation: catch and exit silently without retrying.
  2. Retry the download if cancellation was unintended (re-invoke downloadTabPage to re-show the infobar).
  3. Ensure the content script is injected/alive before starting (check tab status is 'complete').

Example fix

// before
await downloadTabPage(tabId, message);
// after
try { await downloadTabPage(tabId, message); }
catch (err) { if (err.message !== 'upload_cancelled') throw err; }
Defensive patterns

Strategy: try-catch

Validate before calling

const tab = await browser.tabs.get(tabId);
if (tab.status !== 'complete') await waitForTabComplete(tabId); // content script must be alive

Try / catch

try { await downloadTabPage(tabId, message); } catch (e) { if (e.message === 'upload_cancelled') return; throw e; }

Prevention

When it happens

Trigger: User cancels the upload/processing infobar shown in the tab; the content script fails to respond (page navigated, tab closed, content script not injected) so messaging resolves with no response.

Common situations: Saving a page where the user dismisses the progress/confirm infobar; pages where the content script was reloaded mid-save; saving from a discarded tab.

Related errors


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