{"record":{"id":"b4a069a8073eebca","repo":"remotion-dev/remotion","slug":"restartstudio-is-not-available-in-read-only-stud","errorCode":null,"errorMessage":"restartStudio() is not available in read-only Studio","messagePattern":"restartStudio\\(\\) is not available in read-only Studio","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/api/restart-studio.ts","lineNumber":21,"sourceCode":" * @see [Documentation](https://www.remotion.dev/docs/studio/restart-studio)\n */\n\nimport type {RestartStudioResponse} from '@remotion/studio-shared';\nimport {getRemotionEnvironment} from 'remotion';\nimport {callApi} from '../components/call-api';\nimport {getBrowserStudioOperations} from '../helpers/browser-studio-operations';\n\nexport const restartStudio = (): Promise<RestartStudioResponse> => {\n\tif (!getRemotionEnvironment().isStudio) {\n\t\tthrow new Error('restartStudio() is only available in the Studio');\n\t}\n\n\tif (getBrowserStudioOperations() !== null) {\n\t\tthrow new Error('restartStudio() is not supported in Browser Studio');\n\t}\n\n\tif (window.remotion_isReadOnlyStudio) {\n\t\tthrow new Error('restartStudio() is not available in read-only Studio');\n\t}\n\n\treturn callApi('/api/restart-studio', {});\n};\n","sourceCodeStart":3,"sourceCodeEnd":26,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/studio/src/api/restart-studio.ts#L3-L26","documentation":"`restartStudio()` requires a writable, server-backed Studio because it asks the Studio server to restart itself. When `window.remotion_isReadOnlyStudio` is true (Studio deployed in read-only mode, without write access to the project), the guard at packages/studio/src/api/restart-studio.ts:20 throws before any API call. The error signals an environment restriction, not a bug in the call.","triggerScenarios":"Invoking `restartStudio()` from `@remotion/studio` while `window.remotion_isReadOnlyStudio` is set — i.e. a read-only Studio deployment (static/embedded Studio without file or server access). The other guards pass (it IS Studio and not Browser Studio), then this third guard fires.","commonSituations":"Studio opened from a read-only mount or embedded viewer (docs/demo deployments, sandboxed previews); CI/static exports of Studio; attempting write-type operations (restart, save, install) in environments intentionally locked to read-only.","solutions":["Run the full Studio from your project directory with `npx remotion studio`, which is not read-only, and call `restartStudio()` there.","Guard the call site with `window.remotion_isReadOnlyStudio` before invoking `restartStudio()`.","In read-only deployments, restart by restarting the hosting process/page instead of this API."],"exampleFix":"// before\nimport {restartStudio} from '@remotion/studio';\nawait restartStudio(); // throws: read-only Studio\n\n// after\nimport {restartStudio} from '@remotion/studio';\n\nif (!window.remotion_isReadOnlyStudio) {\n  await restartStudio();\n}","handlingStrategy":"type-guard","validationCode":"if (!window.remotion_isReadOnlyStudio) {\n  const {restartStudio} = await import('@remotion/studio');\n  await restartStudio();\n}","typeGuard":"const isWritableStudio = (): boolean =>\n  typeof window !== 'undefined' && !window.remotion_isReadOnlyStudio;","tryCatchPattern":"try {\n  await restartStudio();\n} catch (err) {\n  if (err instanceof Error && err.message.includes('read-only Studio')) {\n    // Read-only deployment: nothing to restart here\n  } else {\n    throw err;\n  }\n}","preventionTips":["Hide write-mode actions (restart, save, install) whenever `window.remotion_isReadOnlyStudio` is set.","Test Studio extensions in both writable (`npx remotion studio`) and read-only deployments before shipping."],"tags":["studio","read-only","restart","environment"],"backgroundTag":"read-only-environment-restriction","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}