{"record":{"id":"1b5a83db47c6a22c","repo":"remotion-dev/remotion","slug":"invalid-render-type-must-be-either-media-or-st","errorCode":null,"errorMessage":"Invalid render type, must be either \"media\" or \"still\"","messagePattern":"Invalid render type, must be either \"media\" or \"still\"","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"packages/cloudrun/src/functions/index.ts","lineNumber":21,"sourceCode":"import {CloudRunPayload} from './helpers/payloads';\nimport {renderMediaSingleThread} from './render-media-single-thread';\nimport {renderStillSingleThread} from './render-still-single-thread';\n\nconst renderOnCloudRun = async (req: ff.Request, res: ff.Response) => {\n\ttry {\n\t\tconst body = CloudRunPayload.parse(req.body);\n\t\tconst renderType = body.type;\n\n\t\tswitch (renderType) {\n\t\t\tcase 'media':\n\t\t\t\tawait renderMediaSingleThread(body, res);\n\t\t\t\tbreak;\n\t\t\tcase 'still':\n\t\t\t\tawait renderStillSingleThread(body, res);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tres\n\t\t\t\t\t.status(400)\n\t\t\t\t\t.send('Invalid render type, must be either \"media\" or \"still\"');\n\t\t}\n\t} catch (err) {\n\t\tconst response: ErrorResponsePayload = {\n\t\t\ttype: 'error',\n\t\t\tmessage: (err as Error).message,\n\t\t\tname: (err as Error).name,\n\t\t\tstack: (err as Error).stack as string,\n\t\t};\n\t\tres.write(JSON.stringify(response));\n\t\tres.end();\n\t}\n};\n\nexport {renderOnCloudRun};\n","sourceCodeStart":3,"sourceCodeEnd":37,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/functions/index.ts#L3-L37","documentation":"Returned as an HTTP 400 response by the Cloud Run function's main handler when the request body's type field is neither 'media' nor 'still'. The function only supports these two render modes.","triggerScenarios":"The Cloud Run function receives a request where body.type is missing or set to an unrecognized value (anything other than 'media' or 'still').","commonSituations":"Calling the Cloud Run endpoint directly with a malformed payload, using an incompatible @remotion/cloudrun client version that sends a different type, or a proxy mutating the body.","solutions":["Use the @remotion/cloudrun SDK's renderMediaOnCloudRun() or renderStillOnCloudRun() rather than calling the endpoint manually.","Ensure the @remotion/cloudrun client and the deployed service share the same version.","If calling directly, set body.type to 'media' or 'still'."],"exampleFix":"// before: manual fetch with wrong type\nfetch(cloudRunUrl, {body: JSON.stringify({type: 'video', ...})});\n// after: use the SDK\nawait renderMediaOnCloudRun({serviceName, region, serveUrl, composition});","handlingStrategy":"validation","validationCode":"const validTypes = ['media', 'still'];\nif (!validTypes.includes(body.type)) {\n  throw new Error(`Invalid render type: ${body.type}`);\n}","typeGuard":"const isValidRenderType = (t): t is 'media' | 'still' =>\n  t === 'media' || t === 'still';","tryCatchPattern":null,"preventionTips":["Use the official @remotion/cloudrun SDK instead of raw HTTP calls.","Keep client and service versions aligned."],"tags":["cloudrun","gcp","http","validation","render-type"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}