{"record":{"id":"3886e0382b5f4191","repo":"remotion-dev/remotion","slug":"no-frames-were-added-to-the-canvas-recording","errorCode":null,"errorMessage":"No frames were added to the canvas recording.","messagePattern":"No frames were added to the canvas recording\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/canvas-capture-extension/src/recorder.ts","lineNumber":329,"sourceCode":"\t\t} finally {\n\t\t\trecording.isEncodingFrame = false;\n\t\t}\n\t})();\n\trecording.lastFramePromise.catch(() => undefined);\n};\n\nconst finalizeRecording = async (\n\trecording: RecordingState,\n\tfilename: string,\n\tformat: CaptureFormat,\n): Promise<File> => {\n\tawait recording.lastFramePromise;\n\tif (recording.hasEncodingError) {\n\t\tthrow recording.encodingError;\n\t}\n\n\tif (recording.frameCount === 0) {\n\t\tthrow new Error('No frames were added to the canvas recording.');\n\t}\n\n\trecording.source.close();\n\tawait recording.output.finalize();\n\n\tif (!recording.target.buffer) {\n\t\tthrow new Error('Mediabunny did not return an output buffer.');\n\t}\n\n\tconst captureData = JSON.stringify({\n\t\tstartedAt: recording.startedAt,\n\t\tendedAt: performance.now(),\n\t\tcaptureMetadata: recording.captureMetadata,\n\t\tmouseMovements: recording.mouseMovements,\n\t\tpointerClicks: recording.pointerClicks,\n\t});\n\n\tconst {","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/canvas-capture-extension/src/recorder.ts#L311-L347","documentation":"Inside `finalizeRecording`, after awaiting the last frame and checking `hasEncodingError`, the code requires `recording.frameCount` to be non-zero. A zero frame count means no `VideoSample` was ever pushed into the Mediabunny source, so there is nothing to encode. Thrown before closing the source and finalizing output.","triggerScenarios":"Stopping the recorder before any frame was drawn/added; the draw loop never fired because the page never repainted; the recorder started but `#draw()` was never invoked before `stopRecording()`.","commonSituations":"Start immediately followed by stop; capturing a static page that does not request animation frames; an earlier paint error prevented frames from being added but did not set `hasEncodingError`.","solutions":["Ensure at least one frame is added before stopping — wait for a paint cycle or a fixed delay.","Verify the page is animating/repainting so the draw loop pushes frames.","Check for and surface `this.#paintError` before stopping.","Do not stop a recorder that never started drawing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let frameCount = 0;\nconst onFrame = () => { frameCount++; };\n// before stopping:\nif (frameCount === 0) throw new Error('No frames captured yet; wait for a paint.');","typeGuard":null,"tryCatchPattern":"try {\n  await recorder.stopRecording();\n} catch (e) {\n  if (e instanceof Error && /No frames were added/.test(e.message)) {\n    await waitForPaint();\n    // restart session rather than retrying the same one.\n  }\n  throw e;\n}","preventionTips":["Track frame count and require >= 1 before stop.","Ensure the page is animating during capture.","Surface paint errors early."],"tags":["canvas-capture","recorder","encoding","no-frames"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}