{"record":{"id":"57d200ab2d966eb9","repo":"remotion-dev/remotion","slug":"invalid-block-size","errorCode":null,"errorMessage":"Invalid block size","messagePattern":"Invalid block size","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/flac/get-block-size.ts","lineNumber":34,"sourceCode":"\t}\n\n\tif (bits >= 0b0010 && bits <= 0b0101) {\n\t\treturn 144 * 2 ** bits;\n\t}\n\n\tif (bits === 0b0110) {\n\t\treturn 'uncommon-u8';\n\t}\n\n\tif (bits === 0b0111) {\n\t\treturn 'uncommon-u16';\n\t}\n\n\tif (bits >= 0b1000 && bits <= 0b1111) {\n\t\treturn 2 ** bits;\n\t}\n\n\tthrow new Error('Invalid block size');\n};\n","sourceCodeStart":16,"sourceCodeEnd":36,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/flac/get-block-size.ts#L16-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"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 === 'Invalid block size') {\n    // This is effectively unreachable; if hit, report as internal bug\n    console.error('Internal parser error in FLAC block size. Report this file to Remotion.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["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."],"tags":["flac","media-parser","block-size","unreachable","defensive"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}