remotion-dev/remotion · error · Error
Should not happen
Error message
Should not happen
What it means
Internal invariant in get-seeking-byte: byteToSeekTo was chosen as Math.max of the candidate seek bytes, but the subsequent timeInSeconds IIFE did not match any of the three sources (observed keyframe, cues, first media section). The comment 'Should not happen' marks it as a logic bug rather than a file-format issue.
Source
Thrown at packages/media-parser/src/containers/webm/seek/get-seeking-byte.ts:185
});
const timeInSeconds = (() => {
if (byteToSeekTo === byteFromObservedKeyframe?.positionInBytes) {
return Math.min(
byteFromObservedKeyframe.decodingTimeInSeconds,
byteFromObservedKeyframe.presentationTimeInSeconds,
);
}
if (byteToSeekTo === byteFromCues?.byte) {
return byteFromCues.timeInSeconds;
}
if (byteToSeekTo === byteFromFirstMediaSection) {
return 0;
}
throw new Error('Should not happen');
})();
return {
type: 'do-seek',
byte: byteToSeekTo,
timeInSeconds,
};
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Retry the seek at a slightly different time to avoid the numeric coincidence.
- Parse linearly (no seek) to bypass the seek path entirely.
- Report the issue to the Remotion maintainers with the offending file and seek time, and use Mediabunny in the meantime.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await parseMedia({src: 'in.mkv', fields: {durationInSeconds: true}});
} catch (err) {
if (err instanceof Error && err.message === 'Should not happen') {
// internal invariant - avoid seeking, parse linearly instead
await parseMedia({src: 'in.mkv', fields: {slowDurationInSeconds: true}});
} else { throw err; }
} Prevention
- Avoid seek-based fields (durationInSeconds, keyframes) on this file; use the slow/* linear fields instead.
- Report the file + seek time to Remotion maintainers.
- Use Mediabunny as an alternate parser.
When it happens
Trigger: Reached when two of the candidate sources reported the same byte value but Math.max picked that value while the equality checks each compared against a possibly-undefined nullable field - a numeric coincidence or a regression in the seek logic. Practically rare and not user-fixable.
Common situations: A parser regression or an exotic file where two seek sources resolve to byte 0 simultaneously. Report rather than work around.
Related errors
- Expected CuePoint
- Expected CueTime
- Expected CueTrackPositions
- Expected CueTrack
- Expected CueClusterPosition
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/2d1039c448784c9a.
Report an issue: GitHub.