remotion-dev/remotion · error
Invalid block size
Error message
Invalid block size
What it means
Thrown by getBlockSize() when the 4-bit block-size field in a FLAC frame header does not match any of the defined patterns. Per RFC 9639, the 4 bits cover: 0b0000 (reserved/get from streaminfo), 0b0001 (192 samples), 0b0010-0b0101 (scaled from 144*2^n), 0b0110 (u8 uncommon), 0b0111 (u16 uncommon), and 0b1000-0b1111 (2^n). Since every 4-bit value maps to one of these branches, this throw is effectively unreachable defensive code — it would only fire if the bit-reading logic itself were broken.
Source
Thrown at packages/media-parser/src/containers/flac/get-block-size.ts:34
}
if (bits >= 0b0010 && bits <= 0b0101) {
return 144 * 2 ** bits;
}
if (bits === 0b0110) {
return 'uncommon-u8';
}
if (bits === 0b0111) {
return 'uncommon-u16';
}
if (bits >= 0b1000 && bits <= 0b1111) {
return 2 ** bits;
}
throw new Error('Invalid block size');
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- If you encounter this, it is likely a bug in @remotion/media-parser — report it with the exact FLAC file and the parsed bits value.
- Verify you are on the latest version of @remotion/media-parser; the branch logic may have been fixed.
- 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 === 'Invalid block size') {
// This is effectively unreachable; if hit, report as internal bug
console.error('Internal parser error in FLAC block size. Report this file to Remotion.');
} else {
throw e;
}
} Prevention
- Keep @remotion/media-parser updated to the latest version.
- If this error appears, report the file and stack trace to the Remotion team.
- Migrate to Mediabunny as a more actively maintained alternative.
When it happens
Trigger: Logically unreachable: all 16 possible 4-bit values (0b0000 through 0b1111) are handled by prior branches. Would only trigger in case of an internal logic error in the iterator's getBits() returning an out-of-range value, or if the function's branch logic were edited to introduce a gap.
Common situations: Should never occur in normal operation. If observed, it indicates either a bug in the BufferIterator bit-reading implementation or a modification to getBlockSize that removed a branch without removing the fallthrough throw.
Related errors
- Invalid channel count: ${bits.toString(2)}
- Invalid sample rate mode: ${mode.toString(2)}
- Blocking bit should be set
- Cannot determine timestamp
- Streaminfo not found
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/57d200ab2d966eb9.
Report an issue: GitHub.