remotion-dev/remotion · error · Error
Could not reorder sequence
Error message
Could not reorder sequence
What it means
Returned as `{success: false, reason: 'Could not reorder sequence'}` by reorderSequence in @remotion/browser-studio. The reorder codemod itself ran and produced new file contents, but `controller.applyMutation(...)` with the node-path remapping list returned null, meaning the project controller could not apply the mutation plus remappings to its tracked state. This almost always means the node paths being remapped no longer line up with what the controller expects (stale paths after a concurrent or prior edit).
Source
Thrown at packages/browser-studio/src/browser-studio-operations.ts:1546
position,
formatFile: formatCodemodFile,
});
const nodePathMutation = controller.applyMutation({
timelineSelection: null,
fileName: absolutePath,
mutate: () => ({
...project,
files: {...project.files, [absolutePath]: result.output},
}),
nodePathMutationFiles: [
{
absolutePath,
remappings: result.nodePathRemappings,
},
],
});
if (nodePathMutation === null) {
throw new Error('Could not reorder sequence');
}
return {success: true, nodePathMutation};
} catch (error) {
return {
success: false,
reason: error instanceof Error ? error.message : String(error),
stack: error instanceof Error && error.stack ? error.stack : '',
};
}
};
const keyframes: BrowserStudioKeyframeOperations = {
addSequenceKeyframe: async (request) => {
const result = await commitKeyframeMutations({
label: `${request.key} keyframe`,
sequenceMutations: [
{View on GitHub (pinned to b2f4e34732)
Solutions
- Re-fetch current node paths (re-read the sequence structure after every mutation) and retry the reorder with fresh paths
- Verify the fileName exists via findProjectFile-style lookup before calling
- Sequence your mutations so only one runs at a time (await each operation before computing the next node paths)
- If it reproduces with freshly fetched paths on an unmodified project, capture the file contents and report it as a Browser Studio bug
Example fix
// before
await operations.reorderSequence({
fileName,
sourceNodePath: cachedSourcePath, // captured before last edit
targetNodePath: cachedTargetPath,
position: 'before',
});
// after
// always re-derive paths from the latest state before mutating
const fresh = await operations.getSequenceData(/* current file */);
const result = await operations.reorderSequence({
fileName,
sourceNodePath: fresh.source,
targetNodePath: fresh.target,
position: 'before',
});
if (!result.success) {
// refresh UI state from project and let the user retry
} Defensive patterns
Strategy: validation
Validate before calling
const res = await operations.reorderSequence({fileName, sourceNodePath, targetNodePath, position});
if (!res.success) {
// res.reason === 'Could not reorder sequence': paths are stale
await resyncNodePathsFromProject();
} Prevention
- Re-read node paths from project state immediately before each mutation
- Serialize mutations: await one before computing inputs for the next
- Treat any success:false with this reason as 'stale state' — refresh, then let the user retry
When it happens
Trigger: Calling `reorderSequence({fileName, sourceNodePath, targetNodePath, position})` with node paths captured before another mutation changed the file; reordering while a previous mutation's remappings were not yet applied; passing a fileName that resolves to a file whose tracked state diverged from `project.files`.
Common situations: Drag-and-drop reorder in a custom timeline UI where the client cached node paths from an earlier render; two edits racing in the same session; hot-reload or undo/redo leaving the client's node paths stale.
Related errors
- Could not split video from audio
- Could not insert JSX element
- Could not insert Element
- Could not split JSX sequence
- Could not add sequence keyframe
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-08-22).
Data as JSON: /api/errors/dc6bbf0acf24d571.
Report an issue: GitHub.