{"record":{"id":"205748881d40636a","repo":"remotion-dev/remotion","slug":"expected-track-entry-segment","errorCode":null,"errorMessage":"Expected track entry segment","messagePattern":"Expected track entry segment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/get-ready-tracks.ts","lineNumber":44,"sourceCode":"\t\tthrow new Error('No main segment');\n\t}\n\n\tconst tracksSegment = getTracksSegment(mainSegment);\n\n\tif (!tracksSegment) {\n\t\tthrow new Error('No tracks segment');\n\t}\n\n\tconst resolvedTracks: MediaParserTrack[] = [];\n\tconst missingInfo: MediaParserTrack[] = [];\n\n\tfor (const trackEntrySegment of tracksSegment.value) {\n\t\tif (trackEntrySegment.type === 'Crc32') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (trackEntrySegment.type !== 'TrackEntry') {\n\t\t\tthrow new Error('Expected track entry segment');\n\t\t}\n\n\t\tconst track = getTrack({\n\t\t\ttrack: trackEntrySegment,\n\t\t\ttimescale: webmState.getTimescale(),\n\t\t});\n\n\t\tif (!track) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (track.codec === NO_CODEC_PRIVATE_SHOULD_BE_DERIVED_FROM_SPS) {\n\t\t\tconst avc = webmState.getAvcProfileForTrackNumber(track.trackId);\n\t\t\tif (avc) {\n\t\t\t\tresolvedTracks.push({\n\t\t\t\t\t...track,\n\t\t\t\t\tcodec: getCodecStringFromSpsAndPps(avc),\n\t\t\t\t});","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/get-ready-tracks.ts#L26-L62","documentation":"Thrown while iterating the children of the Matroska `Tracks` element in get-ready-tracks.ts:44. After skipping `Crc32` children, every remaining child is required to be a `TrackEntry`; any other EBML element type violates the Matroska spec and aborts track resolution. The error indicates the parser received a structurally invalid `Tracks` segment from the EBML decoder.","triggerScenarios":"Called transitively from `parseMedia()` (or `parseMediaInWorker`) on a WebM/MKV stream whose `Tracks` element contains an element other than `TrackEntry` or `Crc32`. Also reachable if the EBML parser mis-segments the byte stream due to truncation or a malformed Vint size field, producing a spurious child type.","commonSituations":"Corrupt or partially downloaded .webm/.mkv files; files produced by non-conformant muxers that insert undocumented elements under `Tracks`; byte-level truncation where a Cluster bleeds into the Tracks box. Rare in practice — most muxers emit only TrackEntry children.","solutions":["Re-encode or re-mux the source file with a conformant tool (ffmpeg/MKVToolNix) and retry.","Verify the file integrity: compare checksums, re-download, or run `ffprobe` to confirm it parses elsewhere.","If the file is valid, report it to Remotion with the example file at https://remotion.dev/report so the EBML traversal can be extended.","Wrap the `parseMedia()` call in try/catch and degrade gracefully (skip the asset, log the error) since this is unrecoverable for that input."],"exampleFix":"// before\nconst { tracks } = await parseMedia({ src, fields: { tracks: true } });\n\n// after\ntry {\n  const { tracks } = await parseMedia({ src, fields: { tracks: true } });\n} catch (err) {\n  console.error('Unparseable WebM container:', err);\n  // fall back to a known-good asset or skip\n}","handlingStrategy":"try-catch","validationCode":"// No pre-parse validation possible — the defect is inside the EBML tree.\n// Best-effort: reject obviously non-WebM sources before parsing.\nimport { parseMedia } from '@remotion/media-parser';\nasync function safeParse(src) {\n  if (src instanceof Blob && !/webm|matroska|mkv/i.test(src.type)) {\n    throw new Error('Source does not look like a WebM/Matroska container');\n  }\n  return parseMedia({ src, fields: { tracks: true } });\n}","typeGuard":null,"tryCatchPattern":"try {\n  const result = await parseMedia({ src, fields: { tracks: true } });\n} catch (err) {\n  if (err instanceof Error && err.message === 'Expected track entry segment') {\n    // Unrecoverable: the container structure is malformed.\n    console.warn('Malformed WebM container, skipping asset:', src);\n    return null;\n  }\n  throw err;\n}","preventionTips":["Validate file integrity (checksum/re-download) before parsing user-supplied media.","Use ffprobe as a pre-flight check for untrusted assets: if ffprobe fails, the file is corrupt.","Treat all user-uploaded media as untrusted input and wrap parseMedia in try/catch.","Pin @remotion/media-parser to a known-good version; EBML traversal changes between releases."],"tags":["media-parser","webm","matroska","ebml","malformed-input"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}