remotion-dev/remotion · error

Blocking bit changed, it should not

Error message

Blocking bit changed, it should not

What it means

Thrown by parseFlacFrame() when the previously-determined blocking-bit strategy is 1 (fixed-blocksize), but the 16-bit value read at the frame start does not match the expected sync pattern 0b1111111111111001 (0xFFF9). In FLAC, the sync code's least significant bit encodes the blocking strategy; if a subsequent frame's blocking bit differs from what was established in the first frame, the file is inconsistent or corrupt.

Source

Thrown at packages/media-parser/src/containers/flac/parse-flac-frame.ts:172

	state: ParserState;
	iterator: BufferIterator;
}): Promise<ParseResult> => {
	const blockingBit = state.flac.getBlockingBitStrategy();
	const offset = iterator.counter.getOffset();
	const {returnToCheckpoint} = iterator.startCheckpoint();
	iterator.startReadingBits();

	if (blockingBit === undefined) {
		const bits = iterator.getBits(15);
		if (bits !== 0b111111111111100) {
			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 =

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify file integrity: `flac -t input.flac` or `ffprobe input.flac`.
  2. Re-encode to normalize: `ffmpeg -i input.flac output.flac`.
  3. Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata).
  4. Report the file to the Remotion team if standard tools handle it.
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 changed, it should not') {
    console.error('FLAC blocking-bit inconsistency across frames. File is corrupt or non-conformant. Re-encode: ffmpeg -i input.flac output.flac');
  } else {
    throw e;
  }
}

Prevention

When it happens

Trigger: Parsing a FLAC file where the first frame established a blocking-bit strategy of 1 (fixed-blocksize), but a later frame's sync code has a different blocking bit (0 instead of 1). Per RFC 9639, the blocking bit should be consistent across all frames in a stream; a change indicates corruption or a non-conformant encoder.

Common situations: Corrupt FLAC files where individual frame headers have bit errors. Files produced by buggy encoders that inconsistently set the blocking-bit field. Files that were concatenated from multiple FLAC encodes with different blocking strategies. Bit-flip corruption during transfer/storage.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/a40c44f38de3267e. Report an issue: GitHub.