remotion-dev/remotion · error · TypeError

The `<Video>` tag requires a string for `src`, but got ${JSO

Error message

The `<Video>` tag requires a string for `src`, but got ${JSON.stringify(src)} instead.

What it means

Thrown by the public <Video> wrapper in @remotion/media when `src` is present but not a string. Remotion must serialize src into an asset manifest and preload it, so it requires a primitive string; URL objects, numbers, arrays, or any non-string are rejected before media validation runs.

Source

Thrown at packages/media/src/video/video.tsx:104

	toneFrequency,
	showInTimeline,
	debugOverlay,
	headless,
	onError,
	credentials,
	requestInit,
	controls,
	objectFit,
	_experimentalInitiallyDrawCachedFrame,
	effects,
	setMediaDurationInSeconds,
	refForOutline,
	...props
}) => {
	const environment = useRemotionEnvironment();

	if (typeof src !== 'string') {
		throw new TypeError(
			`The \`<Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(
				src,
			)} instead.`,
		);
	}

	validateMediaTrimProps({
		startFrom: undefined,
		endAt: undefined,
		trimBefore,
		trimAfter,
	});

	const {trimBeforeValue, trimAfterValue} = resolveTrimProps({
		startFrom: undefined,
		endAt: undefined,
		trimBefore,
		trimAfter,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure src is a primitive string: <Video src={String(url)} /> or use url.href.
  2. Convert URL objects with .toString() before passing.
  3. Type the composition's src prop strictly as string.

Example fix

// before
<Video src={new URL('https://example.com/clip.mp4')} />

// after
<Video src={'https://example.com/clip.mp4'} />
Defensive patterns

Strategy: type-guard

Validate before calling

const videoSrc = typeof src === 'string' ? src : String(src ?? '');
<Video src={videoSrc} />;

Type guard

const isStringSrc = (v: unknown): v is string => typeof v === 'string';

Prevention

When it happens

Trigger: Passing src as a URL object, a number, an object, or any non-string value to <Video>. Also triggered by spreading an any-typed props object whose src field is not a primitive string.

Common situations: Passing `new URL(...)` instead of the string form, passing a numeric asset id, or receiving src from an untyped source (parsed JSON, query param) without conversion.

Related errors


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