remotion-dev/remotion · error · TypeError
"${name}" must be ${formatEnum(variants)}, but got ${JSON.st
Error message
"${name}" must be ${formatEnum(variants)}, but got ${JSON.stringify(value)} What it means
Thrown by the venetian-blinds effect's assertOptionalEnum when the direction parameter is provided but is not one of the allowed values ('vertical' or 'horizontal'). Undefined is allowed (defaults to 'vertical'); any other string or non-string value fails. The message uses formatEnum to render the allowed values as a human-readable list.
Source
Thrown at packages/effects/src/venetian-blinds.ts:86
}
return `${variants
.slice(0, -1)
.map((variant) => `"${variant}"`)
.join(', ')} or "${variants[variants.length - 1]}"`;
};
const assertOptionalEnum = <T extends string>(
value: unknown,
name: string,
variants: readonly T[],
): void => {
if (value === undefined) {
return;
}
if (!variants.includes(value as T)) {
throw new TypeError(
`"${name}" must be ${formatEnum(variants)}, but got ${JSON.stringify(value)}`,
);
}
};
const resolve = (p: VenetianBlindsParams): VenetianBlindsResolved => ({
progress: p.progress ?? DEFAULT_PROGRESS,
direction: p.direction ?? DEFAULT_DIRECTION,
slats: p.slats ?? DEFAULT_SLATS,
});
const validatePositiveInteger = (value: number, name: string): void => {
if (!Number.isInteger(value)) {
throw new TypeError(
`"${name}" must be an integer, but got ${JSON.stringify(value)}`,
);
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Use one of the two valid values: venetianBlinds({direction: 'vertical'}) or venetianBlinds({direction: 'horizontal'})
- Omit direction entirely to accept the default ('vertical')
- If consuming user input, map it to the canonical enum values before passing
- Use the VenetianBlindsDirection TypeScript type to catch invalid values at compile time
Example fix
// before
const e = venetianBlinds({direction: 'diagonal'});
// after
const e = venetianBlinds({direction: 'horizontal'}); Defensive patterns
Strategy: validation
Validate before calling
const VALID_DIRECTIONS = ['vertical', 'horizontal'] as const;
function isValidDirection(value: unknown): boolean {
return value === undefined || VALID_DIRECTIONS.includes(value as any);
}
// Before calling:
if (!isValidDirection(params.direction)) {
throw new Error(`direction must be 'vertical' or 'horizontal'`);
}
const e = venetianBlinds(params); Type guard
const VENETIAN_BLINDS_DIRECTIONS = ['vertical', 'horizontal'] as const;
type VenetianBlindsDirection = typeof VENETIAN_BLINDS_DIRECTIONS[number];
function isVenetianBlindsDirection(
value: unknown,
): value is VenetianBlindsDirection {
return (
value === 'vertical' || value === 'horizontal'
);
} Prevention
- Use only lowercase 'vertical' or 'horizontal' — the check is case-sensitive
- Import the VenetianBlindsDirection type to get compile-time safety
- Map external/user vocabulary to the canonical enum values before passing
- Omit direction to accept the default 'vertical'
When it happens
Trigger: Calling venetianBlinds({direction: 'diagonal'}) or venetianBlinds({direction: 0}) or venetianBlinds({direction: 'Vertical'}) — note the case sensitivity; only lowercase 'vertical' and 'horizontal' are valid.
Common situations: Developer guesses a direction name not in the enum; capitalization mismatch ('Vertical' vs 'vertical'); data from a dropdown or external source using a different vocabulary; typo in the string.
Related errors
- "${name}" must be an integer, but got ${JSON.stringify(value
- "${name}" must be >= 1, but got ${JSON.stringify(value)}
- "direction" must be ${formatEnum(WAVE_DIRECTIONS)}, but got
- "${name}" must be ${formatEnum(variants)}, but got ${JSON.st
- "${name}" must be ${formatEnum(variants)}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/73ba9e9d4f10bcdb.
Report an issue: GitHub.