{"record":{"id":"a40c44f38de3267e","repo":"remotion-dev/remotion","slug":"blocking-bit-changed-it-should-not","errorCode":null,"errorMessage":"Blocking bit changed, it should not","messagePattern":"Blocking bit changed, it should not","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/flac/parse-flac-frame.ts","lineNumber":172,"sourceCode":"\tstate: ParserState;\n\titerator: BufferIterator;\n}): Promise<ParseResult> => {\n\tconst blockingBit = state.flac.getBlockingBitStrategy();\n\tconst offset = iterator.counter.getOffset();\n\tconst {returnToCheckpoint} = iterator.startCheckpoint();\n\titerator.startReadingBits();\n\n\tif (blockingBit === undefined) {\n\t\tconst bits = iterator.getBits(15);\n\t\tif (bits !== 0b111111111111100) {\n\t\t\tthrow new Error('Invalid sync code');\n\t\t}\n\n\t\tstate.flac.setBlockingBitStrategy(iterator.getBits(1));\n\t} else if (blockingBit === 1) {\n\t\tconst bits = iterator.getBits(16);\n\t\tif (bits !== 0b1111111111111001) {\n\t\t\tthrow new Error('Blocking bit changed, it should not');\n\t\t}\n\t} else if (blockingBit === 0) {\n\t\tconst bits = iterator.getBits(16);\n\t\tif (bits !== 0b1111111111111000) {\n\t\t\tthrow new Error('Blocking bit changed, it should not');\n\t\t}\n\t}\n\n\tconst setBlockingBit = state.flac.getBlockingBitStrategy();\n\tif (setBlockingBit === undefined) {\n\t\tthrow new Error('Blocking bit should be set');\n\t}\n\n\titerator.stopReadingBits();\n\n\tconst structure = state.structure.getFlacStructure();\n\n\tconst minimumFrameSize =","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/flac/parse-flac-frame.ts#L154-L190","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify file integrity: `flac -t input.flac` or `ffprobe input.flac`.","Re-encode to normalize: `ffmpeg -i input.flac output.flac`.","Switch to Mediabunny (https://www.remotion.dev/docs/mediabunny/metadata).","Report the file to the Remotion team if standard tools handle it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const result = await parseMedia({src, fields: {durationInSeconds: true}});\n} catch (e) {\n  if (e instanceof Error && e.message === 'Blocking bit changed, it should not') {\n    console.error('FLAC blocking-bit inconsistency across frames. File is corrupt or non-conformant. Re-encode: ffmpeg -i input.flac output.flac');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Validate FLAC file integrity with `flac -t` before parsing.","Avoid concatenating FLAC files from different encoders.","Re-encode inconsistent FLAC files to normalize frame headers.","Migrate to Mediabunny for more robust FLAC parsing."],"tags":["flac","media-parser","blocking-bit","frame-parsing","corrupt-file","inconsistency"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}