{"record":{"id":"27feafd0ab09917c","repo":"remotion-dev/remotion","slug":"invalid-sample-rate-mode-mode-tostring-2","errorCode":null,"errorMessage":"Invalid sample rate mode: ${mode.toString(2)}","messagePattern":"Invalid sample rate mode: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/flac/get-sample-rate.ts","lineNumber":78,"sourceCode":"\t}\n\n\tif (mode === 0b1011) {\n\t\treturn 96000;\n\t}\n\n\tif (mode === 0b1100) {\n\t\treturn 'uncommon-u8';\n\t}\n\n\tif (mode === 0b1101) {\n\t\treturn 'uncommon-u16';\n\t}\n\n\tif (mode === 0b1110) {\n\t\treturn 'uncommon-u16-10';\n\t}\n\n\tthrow new Error(`Invalid sample rate mode: ${mode.toString(2)}`);\n};\n","sourceCodeStart":60,"sourceCodeEnd":80,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/flac/get-sample-rate.ts#L60-L80","documentation":"Thrown by getSampleRate() when the 4-bit sample-rate mode field does not match any of the 15 handled patterns (0b0000 through 0b1110, with 0b1111 sharing the 0b0000 branch). Since all 16 possible 4-bit values are covered by prior branches, this throw is effectively unreachable defensive code — it would only fire if the bit iterator returned an out-of-range value.","triggerScenarios":"Logically unreachable: all 16 possible 4-bit values (0b0000 through 0b1111) are handled by prior conditional branches. Would only trigger if the iterator's getBits(4) returned a value outside [0, 15], indicating an internal bug.","commonSituations":"Should never occur in normal operation. If observed, it indicates a bug in the BufferIterator bit-reading implementation or an unintended edit to the function's branch logic.","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: {sampleRate: true}});\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid sample rate mode:')) {\n    // Effectively unreachable; if hit, report as internal bug\n    console.error('Internal parser error in FLAC sample rate. Report this file to Remotion.');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Keep @remotion/media-parser updated.","If this error appears, report it as an internal bug to the Remotion team.","Migrate to Mediabunny for a more actively maintained parser."],"tags":["flac","media-parser","sample-rate","unreachable","defensive"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}