{"record":{"id":"f767af895c9ceb7f","repo":"remotion-dev/remotion","slug":"element-source-changed-during-installation-f767af","errorCode":null,"errorMessage":"Element source changed during installation","messagePattern":"Element source changed during installation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio-server/src/preview-server/routes/insert-element.ts","lineNumber":202,"sourceCode":"\t\t\t\tentryPoint,\n\t\t\t\tremotionRoot,\n\t\t\t});\n\t\t\tif (\n\t\t\t\tfinalPlan.safePaths.compositionFileName !==\n\t\t\t\tplan.safePaths.compositionFileName\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t'Composition source changed during Element installation',\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!hasExpectedFileState({\n\t\t\t\t\tactual: finalPlan.expectedFileState,\n\t\t\t\t\texpected: plan.expectedFileState,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tthrow new Error('Element source changed during installation');\n\t\t\t}\n\n\t\t\tconst nodePathMutation = broadcastSequenceNodePathMutation(\n\t\t\t\t[\n\t\t\t\t\t{\n\t\t\t\t\t\tabsolutePath: inserted.fileName,\n\t\t\t\t\t\tremappings: inserted.nodePathRemappings,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tnull,\n\t\t\t);\n\n\t\t\tpushTransactionToUndoStack({\n\t\t\t\tsnapshots: [\n\t\t\t\t\t...(shouldWriteElementFile\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tfilePath: plan.elementFileName,","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio-server/src/preview-server/routes/insert-element.ts#L184-L220","documentation":"During element insertion, the handler captures an expected file state (hash/snapshot) in the plan and re-checks it right before writing the mutation. If the element source file's state no longer matches what was expected when the plan was created, it assumes the file changed concurrently and aborts with this error to avoid overwriting newer content.","triggerScenarios":"The element source file was edited, saved, or regenerated between plan creation and the final write; two install/insert operations racing on the same file; an editor auto-save or formatter running mid-installation.","commonSituations":"Installing an element while Studio hot-reloads or while the file is open with unsaved changes that get flushed during the operation; concurrent insert-element requests from multiple Studio tabs.","solutions":["Retry the element installation after ensuring no other process is editing the target file.","Close the file in editors or disable auto-save/format-on-save during installation.","Perform one installation at a time; avoid running installs in multiple Studio tabs against the same project.","If it reproduces deterministically, revert local modifications to the element source and reinstall from the upstream source."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const statBefore = fs.statSync(elementFilePath);\n// after planning, re-check before writing:\nif (fs.statSync(elementFilePath).mtimeMs !== statBefore.mtimeMs) {\n  throw new Error('file changed, re-plan');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await insertElement(input);\n} catch (e) {\n  if (e.message === 'Element source changed during installation') {\n    await new Promise(r => setTimeout(r, 500));\n    await insertElement(input); // retry with a fresh plan\n  } else throw e;\n}","preventionTips":["Do not edit target files while an element installation is running.","Disable format-on-save/auto-save for the project during installs.","Run one installation at a time; avoid multiple Studio tabs on the same project.","Retry the operation once with a freshly created plan."],"tags":["concurrency","file-conflict","elements"],"backgroundTag":"checksum-mismatch","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}