remotion-dev/remotion · error

Cannot create an undo entry without snapshots

Error message

Cannot create an undo entry without snapshots

What it means

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).

Solutions

  1. This is an internal invariant — report it as a Remotion Studio bug with repro steps
  2. Reload the Studio window to reset the undo stack
  3. Avoid performing edits through automation that bypasses snapshot capture
  4. Check the file actually changed on disk before expecting an undo entry
Defensive patterns

Strategy: try-catch

Try / catch

try {
  makeUndoEntry({snapshots, ...});
} catch (e) {
  if (e.message === 'Cannot create an undo entry without snapshots') {
    // skip undo entry; report Studio bug if reproducible
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18). Data as JSON: /api/errors/38d41b93e4175ca5. Report an issue: GitHub.

Appendix: source

Thrown at packages/studio-server/src/preview-server/undo-stack.ts:124

const getEntryFilePaths = (entry: UndoEntry) => {
	return entry.snapshots.map((snapshot) => snapshot.filePath);
};

const makeUndoEntry = ({
	snapshots,
	description,
	entryType,
	suppressHmrOnFileRestore,
	undoRedoNavigation,
}: {
	snapshots: UndoEntrySnapshot[];
	description: UndoEntryDescription;
	entryType: UndoEntryType;
	suppressHmrOnFileRestore: boolean;
	undoRedoNavigation: UndoRedoNavigation | null;
}): UndoEntry => {
	if (snapshots.length === 0) {
		throw new Error('Cannot create an undo entry without snapshots');
	}

	return {
		filePath: snapshots[0].filePath,
		logLine: snapshots[0].logLine,
		snapshots,
		description,
		entryType,
		suppressHmrOnFileRestore,
		undoRedoNavigation,
	};
};

export function pushToUndoStack({
	filePath,
	oldContents,
	newContents,
	logLevel,

View on GitHub (pinned to 46a3a6bf13)