{"record":{"id":"38d41b93e4175ca5","repo":"remotion-dev/remotion","slug":"cannot-create-an-undo-entry-without-snapshots","errorCode":null,"errorMessage":"Cannot create an undo entry without snapshots","messagePattern":"Cannot create an undo entry without snapshots","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio-server/src/preview-server/undo-stack.ts","lineNumber":124,"sourceCode":"const getEntryFilePaths = (entry: UndoEntry) => {\n\treturn entry.snapshots.map((snapshot) => snapshot.filePath);\n};\n\nconst makeUndoEntry = ({\n\tsnapshots,\n\tdescription,\n\tentryType,\n\tsuppressHmrOnFileRestore,\n\tundoRedoNavigation,\n}: {\n\tsnapshots: UndoEntrySnapshot[];\n\tdescription: UndoEntryDescription;\n\tentryType: UndoEntryType;\n\tsuppressHmrOnFileRestore: boolean;\n\tundoRedoNavigation: UndoRedoNavigation | null;\n}): UndoEntry => {\n\tif (snapshots.length === 0) {\n\t\tthrow new Error('Cannot create an undo entry without snapshots');\n\t}\n\n\treturn {\n\t\tfilePath: snapshots[0].filePath,\n\t\tlogLine: snapshots[0].logLine,\n\t\tsnapshots,\n\t\tdescription,\n\t\tentryType,\n\t\tsuppressHmrOnFileRestore,\n\t\tundoRedoNavigation,\n\t};\n};\n\nexport function pushToUndoStack({\n\tfilePath,\n\toldContents,\n\tnewContents,\n\tlogLevel,","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/remotion-dev/remotion/blob/46a3a6bf13ca367376ff18bbb06dae2e87e0d068/packages/studio-server/src/preview-server/undo-stack.ts#L106-L142","documentation":"makeUndoEntry builds an undo stack entry from an array of file snapshots. An entry with zero snapshots cannot point to any file or restore any state, so the function throws this invariant error. This is an internal consistency check in Studio's undo/redo machinery (called from entry, popUndo, and popRedo paths).","triggerScenarios":"Any code path that calls makeUndoEntry with an empty snapshots array — e.g. a tracked file change produced no snapshots, or popUndo/popRedo constructed an entry from an already-empty buffer.","commonSituations":"A Studio bug where an edit event fired without captured file contents; concurrent edits clearing snapshots before the entry is committed; a plugin/automation invoking the undo API incorrectly.","solutions":["This is an internal invariant — report it as a Remotion Studio bug with repro steps","Reload the Studio window to reset the undo stack","Avoid performing edits through automation that bypasses snapshot capture","Check the file actually changed on disk before expecting an undo entry"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  makeUndoEntry({snapshots, ...});\n} catch (e) {\n  if (e.message === 'Cannot create an undo entry without snapshots') {\n    // skip undo entry; report Studio bug if reproducible\n  }\n}","preventionTips":["Only call undo APIs after a tracked file change produced snapshots","Report reproducible occurrences to the Remotion repository","Reload Studio if the undo stack appears corrupted"],"tags":["undo-stack","invariant","studio"],"backgroundTag":"internal-invariant-violation","analyzedSha":"46a3a6bf13ca367376ff18bbb06dae2e87e0d068","analyzedAt":"2026-09-18T00:12:20.256Z","contentChangedAt":"2026-09-18T00:12:20.256Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}