remotion-dev/remotion · error · Error

The canvas capture could not be found.

Error message

The canvas capture could not be found.

What it means

Thrown by the receiver when reading capture metadata from `chrome.storage.local`. It validates that the stored object has string `filename`, string `mimeType`, and a non-negative safe-integer `chunks`. If the metadata key is absent or any field is missing/wrong-typed, the capture id is treated as unknown. This guards the start message before chunks are streamed back to the page.

Source

Thrown at packages/canvas-capture-extension/src/receiver.ts:43

		`${url.pathname}${url.search}${url.hash}`,
	);
};

const deliverCapture = async (id: string) => {
	const metadataKey = getMetadataKey(id);
	const storedMetadata = await chrome.storage.local.get(metadataKey);
	const metadata = storedMetadata[metadataKey] as
		| StoredCaptureMetadata
		| undefined;

	if (
		!metadata ||
		typeof metadata.filename !== 'string' ||
		typeof metadata.mimeType !== 'string' ||
		!Number.isSafeInteger(metadata.chunks) ||
		metadata.chunks < 0
	) {
		throw new Error('The canvas capture could not be found.');
	}

	window.postMessage(
		{
			type: `${MESSAGE_PREFIX}-start`,
			captureId: id,
			filename: metadata.filename,
			mimeType: metadata.mimeType,
			chunks: metadata.chunks,
		},
		window.location.origin,
	);

	for (let index = 0; index < metadata.chunks; index++) {
		const key = getChunkKey(id, index);
		const storedChunk = await chrome.storage.local.get(key);
		const chunk = storedChunk[key];
		if (typeof chunk !== 'string') {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Use the capture id returned by a successful capture session, not a hardcoded or stale value.
  2. Verify the capture completed and wrote metadata before requesting playback.
  3. Check that chrome.storage.local has not been cleared and is not over quota.
  4. Re-run the capture if the id is no longer valid.
Defensive patterns

Strategy: validation

Validate before calling

async function captureExists(id: string): Promise<boolean> {
  const m = (await chrome.storage.local.get(`capture:${id}:meta`))[`capture:${id}:meta`];
  return !!m && typeof m.filename === 'string'
    && typeof m.mimeType === 'string'
    && Number.isSafeInteger(m.chunks) && m.chunks >= 0;
}

Type guard

const isStoredMetadata = (v: unknown): v is {filename: string; mimeType: string; chunks: number} =>
  !!v && typeof (v as any).filename === 'string'
  && typeof (v as any).mimeType === 'string'
  && Number.isSafeInteger((v as any).chunks) && (v as any).chunks >= 0;

Try / catch

try {
  await receiver.start(id);
} catch (e) {
  if (e instanceof Error && /could not be found/.test(e.message)) {
    refreshCaptureList();
  }
  throw e;
}

Prevention

When it happens

Trigger: Posting a start request for a capture id whose metadata was never written, was cleared from `chrome.storage.local`, or was corrupted. Also thrown if the stored metadata has a non-string filename/mimeType or a chunks value that is not a non-negative safe integer.

Common situations: Using a stale/expired capture id; chrome.storage.local was cleared; capture was interrupted before metadata was written; storage quota evicted the entry; type drift from an older extension version.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/5e5cfdc91003743a. Report an issue: GitHub.