remotion-dev/remotion · error · Error

"${name}" must be an object, but you passed a value of type

Error message

"${name}" must be an object, but you passed a value of type ${typeof defaultProps}

What it means

`validateDefaultAndInputProps` requires that `defaultProps`/`inputProps` passed to a `<Composition>` be a plain object. A falsy value (null/undefined/0/'') is allowed (treated as 'none'), but any other non-object primitive (string, number, boolean, symbol, bigint) throws. This runs during `<Composition>` registration.

Source

Thrown at packages/core/src/validation/validate-default-props.ts:11

export const validateDefaultAndInputProps = (
	defaultProps: unknown,
	name: 'defaultProps' | 'inputProps',
	compositionId: string | null,
) => {
	if (!defaultProps) {
		return;
	}

	if (typeof defaultProps !== 'object') {
		throw new Error(
			`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`,
		);
	}

	if (Array.isArray(defaultProps)) {
		throw new Error(
			`"${name}" must be an object, an array was passed ${
				compositionId ? `for composition "${compositionId}"` : ''
			}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Wrap scalars in an object: `defaultProps={{count: 42}}`.
  2. If you have no default props, omit the prop (or pass nothing) instead of a primitive.
  3. Parse config into an object before assigning.

Example fix

// before
<Composition defaultProps={42} ... />
// after
<Composition defaultProps={{count: 42}} ... />
Defensive patterns

Strategy: validation

Validate before calling

function assertPropsObject(p, name) {
  if (p && typeof p !== 'object') {
    throw new Error(name + ' must be an object, got ' + typeof p);
  }
}

Type guard

const isPropsObject = (p) => p == null || (typeof p === 'object' && !Array.isArray(p));

Prevention

When it happens

Trigger: Passing `defaultProps` or `inputProps` as a primitive — e.g. `defaultProps={42}`, `defaultProps="hello"`, `defaultProps={true}` — to a `<Composition>`.

Common situations: Forwarding a single scalar config value directly as props instead of wrapping it; deserializing a JSON string and passing the resulting primitive; misreading the prop as taking a single value rather than an object bag.

Related errors


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