{"record":{"id":"2869d8792b9162ed","repo":"remotion-dev/remotion","slug":"shutdownstudio-is-only-available-in-the-studio","errorCode":null,"errorMessage":"shutDownStudio() is only available in the Studio","messagePattern":"shutDownStudio\\(\\) is only available in the Studio","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/studio/src/api/shut-down-studio.ts","lineNumber":13,"sourceCode":"/**\n * @description Shuts down the Remotion Studio.\n * @see [Documentation](https://www.remotion.dev/docs/studio/shut-down-studio)\n */\n\nimport type {ShutdownStudioResponse} from '@remotion/studio-shared';\nimport {getRemotionEnvironment} from 'remotion';\nimport {callApi} from '../components/call-api';\nimport {getBrowserStudioOperations} from '../helpers/browser-studio-operations';\n\nexport const shutDownStudio = (): Promise<ShutdownStudioResponse> => {\n\tif (!getRemotionEnvironment().isStudio) {\n\t\tthrow new Error('shutDownStudio() is only available in the Studio');\n\t}\n\n\tif (getBrowserStudioOperations() !== null) {\n\t\tthrow new Error('shutDownStudio() is not supported in Browser Studio');\n\t}\n\n\tif (window.remotion_isReadOnlyStudio) {\n\t\tthrow new Error('shutDownStudio() is not available in read-only Studio');\n\t}\n\n\treturn callApi('/api/shutdown-studio', {});\n};\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/api/shut-down-studio.ts#L1-L26","documentation":"shutDownStudio() is a Studio-only API that asks the Remotion Studio process to shut down. When called outside the Studio (e.g. inside a rendered video, preview in a regular browser tab, or plain web app), the environment check fails and the error is thrown.","triggerScenarios":"Calling shutDownStudio() from a Remotion composition, a render environment, or any non-Studio page where getRemotionEnvironment().isStudio is false.","commonSituations":"Code shared between compositions and Studio UI; calling it from a Player-embedded app; accidentally importing the API into a normal React app; running a rendered video that includes Studio-only calls.","solutions":["Only call shutDownStudio() in code that runs inside Remotion Studio","Guard the call with getRemotionEnvironment().isStudio","Use window.remotion_isStudio (or equivalent check) before invoking","Move the call out of shared video code into Studio-only UI modules"],"exampleFix":"// before\nawait shutDownStudio();\n// after\nimport {getRemotionEnvironment} from 'remotion';\nif (getRemotionEnvironment().isStudio) {\n  await shutDownStudio();\n}","handlingStrategy":"type-guard","validationCode":"import {getRemotionEnvironment} from 'remotion';\nconst canShutdown = getRemotionEnvironment().isStudio;","typeGuard":"const inStudio = (): boolean => getRemotionEnvironment().isStudio;","tryCatchPattern":"try {\n  await shutDownStudio();\n} catch (e) {\n  if ((e as Error).message.includes('only available in the Studio')) {\n    // ignore: not running in Studio\n  } else { throw e; }\n}","preventionTips":["Only import shutDownStudio in Studio-only modules","Guard with getRemotionEnvironment().isStudio before calling","Don't call Studio APIs from compositions or rendered videos"],"tags":["studio","environment","api-misuse"],"backgroundTag":"unsupported-operation","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"}