{"record":{"id":"2d1039c448784c9a","repo":"remotion-dev/remotion","slug":"should-not-happen","errorCode":null,"errorMessage":"Should not happen","messagePattern":"Should not happen","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/seek/get-seeking-byte.ts","lineNumber":185,"sourceCode":"\t});\n\n\tconst timeInSeconds = (() => {\n\t\tif (byteToSeekTo === byteFromObservedKeyframe?.positionInBytes) {\n\t\t\treturn Math.min(\n\t\t\t\tbyteFromObservedKeyframe.decodingTimeInSeconds,\n\t\t\t\tbyteFromObservedKeyframe.presentationTimeInSeconds,\n\t\t\t);\n\t\t}\n\n\t\tif (byteToSeekTo === byteFromCues?.byte) {\n\t\t\treturn byteFromCues.timeInSeconds;\n\t\t}\n\n\t\tif (byteToSeekTo === byteFromFirstMediaSection) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tthrow new Error('Should not happen');\n\t})();\n\n\treturn {\n\t\ttype: 'do-seek',\n\t\tbyte: byteToSeekTo,\n\t\ttimeInSeconds,\n\t};\n};\n","sourceCodeStart":167,"sourceCodeEnd":194,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/seek/get-seeking-byte.ts#L167-L194","documentation":"Internal invariant in get-seeking-byte: byteToSeekTo was chosen as Math.max of the candidate seek bytes, but the subsequent timeInSeconds IIFE did not match any of the three sources (observed keyframe, cues, first media section). The comment 'Should not happen' marks it as a logic bug rather than a file-format issue.","triggerScenarios":"Reached when two of the candidate sources reported the same byte value but Math.max picked that value while the equality checks each compared against a possibly-undefined nullable field - a numeric coincidence or a regression in the seek logic. Practically rare and not user-fixable.","commonSituations":"A parser regression or an exotic file where two seek sources resolve to byte 0 simultaneously. Report rather than work around.","solutions":["Retry the seek at a slightly different time to avoid the numeric coincidence.","Parse linearly (no seek) to bypass the seek path entirely.","Report the issue to the Remotion maintainers with the offending file and seek time, and use Mediabunny in the meantime."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src: 'in.mkv', fields: {durationInSeconds: true}});\n} catch (err) {\n  if (err instanceof Error && err.message === 'Should not happen') {\n    // internal invariant - avoid seeking, parse linearly instead\n    await parseMedia({src: 'in.mkv', fields: {slowDurationInSeconds: true}});\n  } else { throw err; }\n}","preventionTips":["Avoid seek-based fields (durationInSeconds, keyframes) on this file; use the slow/* linear fields instead.","Report the file + seek time to Remotion maintainers.","Use Mediabunny as an alternate parser."],"tags":["webm","matroska","media-parser","seek","internal-invariant","bug"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}