remotion-dev/remotion · error

Invalid render type, must be either "media" or "still"

Error message

Invalid render type, must be either "media" or "still"

What it means

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.

Source

Thrown at packages/cloudrun/src/functions/index.ts:21

import {CloudRunPayload} from './helpers/payloads';
import {renderMediaSingleThread} from './render-media-single-thread';
import {renderStillSingleThread} from './render-still-single-thread';

const renderOnCloudRun = async (req: ff.Request, res: ff.Response) => {
	try {
		const body = CloudRunPayload.parse(req.body);
		const renderType = body.type;

		switch (renderType) {
			case 'media':
				await renderMediaSingleThread(body, res);
				break;
			case 'still':
				await renderStillSingleThread(body, res);
				break;
			default:
				res
					.status(400)
					.send('Invalid render type, must be either "media" or "still"');
		}
	} catch (err) {
		const response: ErrorResponsePayload = {
			type: 'error',
			message: (err as Error).message,
			name: (err as Error).name,
			stack: (err as Error).stack as string,
		};
		res.write(JSON.stringify(response));
		res.end();
	}
};

export {renderOnCloudRun};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Use the @remotion/cloudrun SDK's renderMediaOnCloudRun() or renderStillOnCloudRun() rather than calling the endpoint manually.
  2. Ensure the @remotion/cloudrun client and the deployed service share the same version.
  3. If calling directly, set body.type to 'media' or 'still'.

Example fix

// before: manual fetch with wrong type
fetch(cloudRunUrl, {body: JSON.stringify({type: 'video', ...})});
// after: use the SDK
await renderMediaOnCloudRun({serviceName, region, serveUrl, composition});
Defensive patterns

Strategy: validation

Validate before calling

const validTypes = ['media', 'still'];
if (!validTypes.includes(body.type)) {
  throw new Error(`Invalid render type: ${body.type}`);
}

Type guard

const isValidRenderType = (t): t is 'media' | 'still' =>
  t === 'media' || t === 'still';

Prevention

When it happens

Trigger: The Cloud Run function receives a request where body.type is missing or set to an unrecognized value (anything other than 'media' or 'still').

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/1b5a83db47c6a22c. Report an issue: GitHub.