{"record":{"id":"610104e1e164577c","repo":"remotion-dev/remotion","slug":"blocking-bit-should-be-set","errorCode":null,"errorMessage":"Blocking bit should be set","messagePattern":"Blocking bit should be set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/flac/parse-flac-frame.ts","lineNumber":183,"sourceCode":"\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 =\n\t\tstructure.boxes.find((b) => b.type === 'flac-streaminfo')\n\t\t\t?.minimumFrameSize ?? null;\n\tif (minimumFrameSize === null) {\n\t\tthrow new Error('Expected flac-streaminfo');\n\t}\n\n\tif (minimumFrameSize !== 0) {\n\t\titerator.getSlice(minimumFrameSize - 2);\n\t}\n\n\twhile (true) {","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/flac/parse-flac-frame.ts#L165-L201","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"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 should be set') {\n    // Effectively unreachable; if hit, report as internal bug\n    console.error('Internal parser error: FLAC blocking-bit state not set. Report this to Remotion.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["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."],"tags":["flac","media-parser","blocking-bit","unreachable","defensive","internal-state"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}