remotion-dev/remotion · error · Error

Key ${JSON.stringify(key)} is not an enum

Error message

Key ${JSON.stringify(key)} is not an enum

What it means

Thrown by findPropsToDelete when the schema field referenced by `key` exists but is not of type 'enum'. Prop deletion by variant only applies to enum fields; other schema types (e.g. boolean, number, color) cannot be cleared this way.

Source

Thrown at packages/core/src/find-props-to-delete.ts:23

	key,
	value,
}: {
	schema: InteractivitySchema;
	key: string;
	value: unknown;
}) => {
	const fieldSchema = schema[key];

	if (!fieldSchema) {
		throw new Error('Key ' + JSON.stringify(key) + ' not found in schema');
	}

	if (typeof value !== 'string') {
		throw new Error('Value must be a string, but is ' + JSON.stringify(value));
	}

	if (fieldSchema.type !== 'enum') {
		throw new Error('Key ' + JSON.stringify(key) + ' is not an enum');
	}

	const currentVariant = fieldSchema.variants[value as string];
	if (!currentVariant) {
		throw new Error(
			'Value for ' +
				JSON.stringify(key) +
				' must be one of ' +
				Object.keys(fieldSchema.variants)
					.map((v) => JSON.stringify(v))
					.join(', ') +
				', got ' +
				JSON.stringify(value),
		);
	}

	const otherVariants = Object.keys(fieldSchema.variants).filter(
		(v) => v !== value,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Check `schema[key].type === 'enum'` before calling findPropsToDelete.
  2. Route non-enum fields through their appropriate reset path instead of variant deletion.
  3. If the field should be deletable this way, redefine it in the schema with type: 'enum'.
  4. Update the caller after a schema type change.

Example fix

// before
findPropsToDelete({schema, key: 'visible', value: 'true'}); // 'visible' is boolean

// after
if (schema[key].type === 'enum') {
  findPropsToDelete({schema, key, value});
} else {
  // reset non-enum field through its own path
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (schema[key]?.type !== 'enum') {
  // route non-enum fields to their own reset path
  return;
}
findPropsToDelete({schema, key, value});

Type guard

function isEnumField(field: unknown): field is {type: 'enum'; variants: Record<string, unknown>} {
  return typeof field === 'object' && field !== null && (field as {type?: string}).type === 'enum';
}

Prevention

When it happens

Trigger: Calling findPropsToDelete against a schema key whose fieldSchema.type is something other than 'enum' (for example a 'boolean' toggle or a 'color' field).

Common situations: Calling the interactive-prop deletion flow on a non-variant field; schema was changed from enum to another type but the caller still treats it as enum.

Related errors


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