remotion-dev/remotion · error · Error
Unexpected type
Error message
Unexpected type
What it means
parseBlockFlags throws if the supplied element type is neither matroskaElements.Block nor matroskaElements.SimpleBlock. The function's TypeScript signature already narrows the input to those two, so reaching the throw requires either an exhaustiveness leak or a value constructed with the wrong enum constant.
Source
Thrown at packages/media-parser/src/containers/webm/segments/block-simple-block-flags.ts:51
iterator.startReadingBits();
const keyframe = Boolean(iterator.getBits(1));
// Reserved
iterator.getBits(3);
const invisible = Boolean(iterator.getBits(1));
const lacing = iterator.getBits(2);
iterator.getBits(1);
iterator.stopReadingBits();
return {
invisible,
lacing,
keyframe,
};
}
throw new Error('Unexpected type');
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Upgrade or pin @remotion/media-parser to a version where this is not reachable.
- Re-mux the input file in case a corrupted child element confused the dispatcher.
- Report to Remotion maintainers with the file and version, and use Mediabunny.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await parseMedia({src: 'in.webm', fields: {samples: true}});
} catch (err) {
if (err instanceof Error && err.message === 'Unexpected type') {
throw new Error('Internal block-flag dispatch failure; upgrade @remotion/media-parser or re-mux the file.', {cause: err});
}
throw err;
} Prevention
- Pin a known-good @remotion/media-parser version.
- Re-mux the source to normalize block elements.
- Report the file to Remotion maintainers.
When it happens
Trigger: Internal caller passes a type that does not equal the Block or SimpleBlock enum constants (e.g. a string compare mismatch after an enum refactor, or a BlockGroup child that was misidentified as a block). Not reachable through normal file input given the type guard upstream.
Common situations: A library regression after changes to matroskaElements constants, or a corrupted block child whose type field was mutated. Effectively a defensive guard.
Related errors
- Expected block segment
- Should not happen
- has no bytes
- Expected av1 private data to be version 1
- Expected av1 private data to be version 1, got ${version}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/c3e6cf3e7c3ce1fd.
Report an issue: GitHub.