remotion-dev/remotion · error · Error
Could not find composition "${compositionId}"
Error message
Could not find composition "${compositionId}" What it means
resolveCodemodTargetFile (used by applyCodemod) locates the file a composition-addressed codemod should edit. For duplicate-composition, rename-composition, update-composition-metadata, delete-composition and move-composition-to-folder it looks the composition up by id via getCompositionFile; if the VirtualProject contains no composition with that id, this error is thrown with the id in quotes.
Source
Thrown at packages/browser-studio/src/browser-studio-operations.ts:265
project,
symbolicatedStack,
}: {
codemod: RecastCodemod;
project: VirtualProject;
symbolicatedStack: SymbolicatedStackFrame | null;
}): string => {
if (symbolicatedStack?.originalFileName) {
return findProjectFile({
filePath: symbolicatedStack.originalFileName,
project,
});
}
const compositionId = getCodemodTargetCompositionId(codemod);
if (compositionId !== null) {
const compositionFile = getCompositionFile({compositionId, project});
if (compositionFile === null) {
throw new Error(`Could not find composition "${compositionId}"`);
}
return findProjectFile({filePath: compositionFile, project});
}
if (codemod.type === 'rename-folder' || codemod.type === 'delete-folder') {
const folderFile = getFolderFile({
folderName: codemod.folderName,
project,
});
if (folderFile === null) {
throw new Error(`Could not find folder "${codemod.folderName}"`);
}
return findProjectFile({filePath: folderFile, project});
}
if (View on GitHub (pinned to b2f4e34732)
Solutions
- Re-read the composition list from the current project state before issuing the codemod and drop the request if the id is gone.
- Discard queued codemods whenever the incoming project prop changes (BrowserStudio resets history on external project changes; mirror that for your queue).
- Pass symbolicatedStack with originalFileName when the target file is already known, which bypasses the composition lookup.
Defensive patterns
Strategy: validation
Validate before calling
const compositionExists = (project: VirtualProject, id: string): boolean =>
Object.values(project.files).some(
(source) => source.includes(`id="${id}"`) || source.includes(`id={"${id}"}`),
);
const safeCodemod = compositionExists(project, codemod.idToDelete)
? codemod
: null; Type guard
const isCompositionTargetedCodemod = (
codemod: RecastCodemod,
): codemod is
| {type: 'duplicate-composition'; idToDuplicate: string}
| {type: 'rename-composition'; idToRename: string}
| {type: 'update-composition-metadata'; idToUpdate: string}
| {type: 'delete-composition'; idToDelete: string}
| {type: 'move-composition-to-folder'; idToMove: string} =>
codemod.type === 'duplicate-composition' ||
codemod.type === 'rename-composition' ||
codemod.type === 'update-composition-metadata' ||
codemod.type === 'delete-composition' ||
codemod.type === 'move-composition-to-folder'; Prevention
- Re-verify composition ids against the current project immediately before applying codemods.
- Invalidate queued codemods when the project prop changes externally.
- Consume undo/redo and project-change events to keep the id list fresh.
When it happens
Trigger: applyCodemod with one of the five composition codemod types whose id (idToDuplicate / idToRename / idToUpdate / idToDelete / idToMove) does not exist in the current project, and no symbolicatedStack.originalFileName was supplied to bypass the composition lookup.
Common situations: Stale UI state issuing a delete/rename after the composition was already removed or renamed; the host replacing the project prop out-of-band so a queued codemod races against a newer project; ids captured before an undo that removed the composition.
Related errors
- Could not find folder "${codemod.folderName}"
- Could not find the root file of the project
- Could not delete JSX nodes
- Could not split JSX sequence
- Creating canvas capture compositions is not supported in Bro
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-08-22).
Data as JSON: /api/errors/330e85f1af40bab1.
Report an issue: GitHub.