{"record":{"id":"5e5cfdc91003743a","repo":"remotion-dev/remotion","slug":"the-canvas-capture-could-not-be-found","errorCode":null,"errorMessage":"The canvas capture could not be found.","messagePattern":"The canvas capture could not be found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/canvas-capture-extension/src/receiver.ts","lineNumber":43,"sourceCode":"\t\t`${url.pathname}${url.search}${url.hash}`,\n\t);\n};\n\nconst deliverCapture = async (id: string) => {\n\tconst metadataKey = getMetadataKey(id);\n\tconst storedMetadata = await chrome.storage.local.get(metadataKey);\n\tconst metadata = storedMetadata[metadataKey] as\n\t\t| StoredCaptureMetadata\n\t\t| undefined;\n\n\tif (\n\t\t!metadata ||\n\t\ttypeof metadata.filename !== 'string' ||\n\t\ttypeof metadata.mimeType !== 'string' ||\n\t\t!Number.isSafeInteger(metadata.chunks) ||\n\t\tmetadata.chunks < 0\n\t) {\n\t\tthrow new Error('The canvas capture could not be found.');\n\t}\n\n\twindow.postMessage(\n\t\t{\n\t\t\ttype: `${MESSAGE_PREFIX}-start`,\n\t\t\tcaptureId: id,\n\t\t\tfilename: metadata.filename,\n\t\t\tmimeType: metadata.mimeType,\n\t\t\tchunks: metadata.chunks,\n\t\t},\n\t\twindow.location.origin,\n\t);\n\n\tfor (let index = 0; index < metadata.chunks; index++) {\n\t\tconst key = getChunkKey(id, index);\n\t\tconst storedChunk = await chrome.storage.local.get(key);\n\t\tconst chunk = storedChunk[key];\n\t\tif (typeof chunk !== 'string') {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/canvas-capture-extension/src/receiver.ts#L25-L61","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use the capture id returned by a successful capture session, not a hardcoded or stale value.","Verify the capture completed and wrote metadata before requesting playback.","Check that chrome.storage.local has not been cleared and is not over quota.","Re-run the capture if the id is no longer valid."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function captureExists(id: string): Promise<boolean> {\n  const m = (await chrome.storage.local.get(`capture:${id}:meta`))[`capture:${id}:meta`];\n  return !!m && typeof m.filename === 'string'\n    && typeof m.mimeType === 'string'\n    && Number.isSafeInteger(m.chunks) && m.chunks >= 0;\n}","typeGuard":"const isStoredMetadata = (v: unknown): v is {filename: string; mimeType: string; chunks: number} =>\n  !!v && typeof (v as any).filename === 'string'\n  && typeof (v as any).mimeType === 'string'\n  && Number.isSafeInteger((v as any).chunks) && (v as any).chunks >= 0;","tryCatchPattern":"try {\n  await receiver.start(id);\n} catch (e) {\n  if (e instanceof Error && /could not be found/.test(e.message)) {\n    refreshCaptureList();\n  }\n  throw e;\n}","preventionTips":["Use the id from a freshly completed capture.","Do not clear chrome.storage.local between capture and playback.","Handle the error by re-recording."],"tags":["canvas-capture","chrome-storage","metadata","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}