remotion-dev/remotion · error

Expected a sequence registration getter

Error message

Expected a sequence registration getter

What it means

useSequenceRegistration registers a <Sequence> with the SequenceManager on mount. It keeps the registration getter in a ref; if registration is enabled but the getter ref is null, the internal invariant is broken and it throws this error, since a sequence without a getter cannot report its position/duration to the manager.

Source

Thrown at packages/core/src/use-sequence-registration.ts:26

}: {
	getSequence: (() => TSequence) | null;
	id: string;
}) => {
	const {registerSequence, unregisterSequence, updateSequence} =
		useContext(SequenceManager);
	const getSequenceRef = useRef(getSequence);
	getSequenceRef.current = getSequence;
	const lastRegisteredGetterRef = useRef<(() => TSequence) | null>(null);
	const registrationEnabled = getSequence !== null;

	useEffect(() => {
		if (!registrationEnabled) {
			return;
		}

		const currentGetter = getSequenceRef.current;
		if (currentGetter === null) {
			throw new Error('Expected a sequence registration getter');
		}

		registerSequence(currentGetter());
		lastRegisteredGetterRef.current = currentGetter;

		return () => {
			lastRegisteredGetterRef.current = null;
			unregisterSequence(id);
		};
	}, [id, registerSequence, registrationEnabled, unregisterSequence]);

	useEffect(() => {
		if (
			getSequence === null ||
			updateSequence === null ||
			lastRegisteredGetterRef.current === getSequence
		) {
			return;

View on GitHub (pinned to a6a7485a9a)

Solutions

  1. Render <Sequence> as-is rather than reimplementing useSequenceRegistration in custom code
  2. If mocking, provide a valid getter in the context so getSequenceRef.current is non-null before registration
  3. Ensure the hook's setup effect ordering is preserved (do not conditionally skip ref assignment while enabling registration)
  4. Upgrade to the latest @remotion/core in case of a fixed internal bug
Defensive patterns

Strategy: type-guard

Validate before calling

if (registrationEnabled && getSequenceRef.current === null) {
  throw new Error('Sequence getter missing before registration');
}

Type guard

const hasGetter = (ref: React.RefObject<(() => SequenceRegistration) | null>): ref is React.RefObject<() => SequenceRegistration> =>
  ref.current !== null;

Try / catch

try {
  registerSequence(getter());
} catch (e) {
  if (e instanceof Error && e.message === 'Expected a sequence registration getter') {
    // retry after refs are assigned, or skip registration
  } else throw e;
}

Prevention

When it happens

Trigger: registerSequence effect runs while getSequenceRef.current is null — registration was enabled but the component never populated the getter ref (misordered internal setup, custom subclassing, or rendering a Sequence variant outside its normal composition path).

Common situations: Custom Sequence-like components copying internal hooks incorrectly; tests mocking SequenceManagerContext with registrationEnabled true but no getter; internal refactors leaving the ref unset when registration is on.

Related errors


AI-assisted analysis of remotion-dev/remotion@a6a7485a9a (2026-09-02). Data as JSON: /api/errors/618bead9e470718a. Report an issue: GitHub.