remotion-dev/remotion · error
Blocking bit should be set
Error message
Blocking bit should be set
What it means
Thrown by parseFlacFrame() when, after the sync-code parsing branches, getBlockingBitStrategy() still returns undefined. The sync-code branch for blockingBit===undefined sets the strategy via setBlockingBitStrategy(); the other two branches (blockingBit===0 or 1) only validate and rely on the pre-existing strategy. Logically this throw is unreachable: if blockingBit was undefined, the strategy gets set; if it was 0 or 1, it is already defined. The check is defensive against an internal state-management bug.
Source
Thrown at packages/media-parser/src/containers/flac/parse-flac-frame.ts:183
throw new Error('Invalid sync code');
}
state.flac.setBlockingBitStrategy(iterator.getBits(1));
} else if (blockingBit === 1) {
const bits = iterator.getBits(16);
if (bits !== 0b1111111111111001) {
throw new Error('Blocking bit changed, it should not');
}
} else if (blockingBit === 0) {
const bits = iterator.getBits(16);
if (bits !== 0b1111111111111000) {
throw new Error('Blocking bit changed, it should not');
}
}
const setBlockingBit = state.flac.getBlockingBitStrategy();
if (setBlockingBit === undefined) {
throw new Error('Blocking bit should be set');
}
iterator.stopReadingBits();
const structure = state.structure.getFlacStructure();
const minimumFrameSize =
structure.boxes.find((b) => b.type === 'flac-streaminfo')
?.minimumFrameSize ?? null;
if (minimumFrameSize === null) {
throw new Error('Expected flac-streaminfo');
}
if (minimumFrameSize !== 0) {
iterator.getSlice(minimumFrameSize - 2);
}
while (true) {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- If you encounter this, report it as an internal bug to the Remotion team.
- Update to the latest @remotion/media-parser version.
- Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata).
Defensive patterns
Strategy: try-catch
Try / catch
try {
const result = await parseMedia({src, fields: {durationInSeconds: true}});
} catch (e) {
if (e instanceof Error && e.message === 'Blocking bit should be set') {
// Effectively unreachable; if hit, report as internal bug
console.error('Internal parser error: FLAC blocking-bit state not set. Report this to Remotion.');
} else {
throw e;
}
} Prevention
- Keep @remotion/media-parser updated to the latest version.
- If this error appears, report it as an internal bug to the Remotion team.
- Migrate to Mediabunny as a more actively maintained alternative.
When it happens
Trigger: Logically unreachable: the blocking-bit strategy is either already set (when blockingBit is 0 or 1) or gets set in the undefined branch. Would only fire if setBlockingBitStrategy() failed to update state, or if the control flow were modified to skip the set call.
Common situations: Should never occur in normal operation. If seen, it indicates an internal state-management bug in the FLAC parser's blocking-bit tracking or an unintended code edit.
Related errors
- Invalid block size
- Invalid channel count: ${bits.toString(2)}
- Invalid sample rate mode: ${mode.toString(2)}
- Blocking bit changed, it should not
- Streaminfo not found
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/610104e1e164577c.
Report an issue: GitHub.