{"record":{"id":"3cfcdd1ecf3ff53c","repo":"remotion-dev/remotion","slug":"expected-cluster","errorCode":null,"errorMessage":"Expected cluster","messagePattern":"Expected cluster","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/parse-webm-header.ts","lineNumber":55,"sourceCode":"\tif (isInsideCluster) {\n\t\tif (maySkipVideoData({state})) {\n\t\t\treturn makeSkip(\n\t\t\t\tMath.min(\n\t\t\t\t\tstate.contentLength,\n\t\t\t\t\tisInsideCluster.size + isInsideCluster.start,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tconst segments = structure.boxes.filter((box) => box.type === 'Segment');\n\t\tconst segment = segments[isInsideCluster.segment];\n\t\tif (!segment) {\n\t\t\tthrow new Error('Expected segment');\n\t\t}\n\n\t\tconst clusters = segment.value.find((box) => box.type === 'Cluster');\n\t\tif (!clusters) {\n\t\t\tthrow new Error('Expected cluster');\n\t\t}\n\n\t\t// let's not add it to the cluster\n\t\tif (results.type !== 'Block' && results.type !== 'SimpleBlock') {\n\t\t\tclusters.value.push(results);\n\t\t}\n\t} else if (isInsideSegment) {\n\t\tconst segments = structure.boxes.filter((box) => box.type === 'Segment');\n\t\tconst segment = segments[isInsideSegment.index];\n\t\tif (!segment) {\n\t\t\tthrow new Error('Expected segment');\n\t\t}\n\n\t\tsegment.value.push(results);\n\t} else {\n\t\tstructure.boxes.push(results);\n\t}\n","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/parse-webm-header.ts#L37-L73","documentation":"The resolved Segment box has no Cluster child (segment.value.find(type==='Cluster') returned undefined). This means a Cluster offset was recorded but the in-memory Segment tree does not yet contain a Cluster node, i.e. state and structure are out of sync.","triggerScenarios":"Cluster registration happened but the Cluster node was never appended to its Segment (parse order anomaly), or the Segment's children were lost during a seek/backtrack. Reachable with malformed files that interleave Cluster and Segment markers unexpectedly.","commonSituations":"Non-standard muxer output, files edited at the binary level, or seek-induced state desync.","solutions":["Re-mux with ffmpeg to normalize Cluster placement.","Disable seeking and parse start-to-end.","Obtain a fresh source file.","Use Mediabunny."],"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 === 'Expected cluster') {\n    throw new Error('Cluster missing from Segment tree; re-mux the file.', {cause: err});\n  }\n  throw err;\n}","preventionTips":["Re-mux uploads to normalize Cluster placement.","Prefer linear parse over seek-based fields on non-trusted files.","Maintain a fallback source."],"tags":["webm","matroska","media-parser","cluster","state","malformed-file"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}