{"record":{"id":"293f3f784db7735f","repo":"remotion-dev/remotion","slug":"expected-track-type-segment","errorCode":null,"errorMessage":"Expected track type segment","messagePattern":"Expected track type segment","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/webm/make-track.ts","lineNumber":273,"sourceCode":"\n\tif (codec.value === 'A_MPEG/L3') {\n\t\treturn 'mp3';\n\t}\n\n\tthrow new Error(`Unknown codec: ${codec.value}`);\n};\n\nexport const getTrack = ({\n\ttimescale,\n\ttrack,\n}: {\n\ttimescale: number;\n\ttrack: TrackEntry;\n}): MediaParserVideoTrack | MediaParserAudioTrack | null => {\n\tconst trackType = getTrackTypeSegment(track);\n\n\tif (!trackType) {\n\t\tthrow new Error('Expected track type segment');\n\t}\n\n\tconst trackId = getTrackId(track);\n\n\tif (trackTypeToString(trackType.value.value) === 'video') {\n\t\tconst width = getWidthSegment(track);\n\n\t\tif (width === null) {\n\t\t\tthrow new Error('Expected width segment');\n\t\t}\n\n\t\tconst height = getHeightSegment(track);\n\n\t\tif (height === null) {\n\t\t\tthrow new Error('Expected height segment');\n\t\t}\n\n\t\tconst displayHeight = getDisplayHeightSegment(track);","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/webm/make-track.ts#L255-L291","documentation":"Thrown by `getTrack` (make-track.ts:273) when `getTrackTypeSegment(track)` returns null — the TrackEntry has no `TrackType` child element. TrackType (video/audio/subtitle/etc.) is mandatory in Matroska and is the first thing `getTrack` reads to dispatch, so its absence prevents any track classification.","triggerScenarios":"A TrackEntry element that lacks the `TrackType` child. Caused by truncated/corrupt EBML, non-conformant muxers, or parser mis-segmentation of the Tracks box.","commonSituations":"Corrupt or partially written MKV/WebM headers; files from experimental muxers; truncated downloads where the Tracks box is incomplete. Rare for files that play correctly anywhere.","solutions":["Re-mux with a conformant tool: `ffmpeg -i in.webm -c copy out.webm` (ffmpeg rewrites well-formed headers).","Verify the file opens in ffprobe/VLC; if not, the source is corrupt.","Re-download or re-encode from the original source.","Catch and reject the asset upstream."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm the file is well-formed before parsing.\nimport { execFile } from 'node:child_process';\nimport { promisify } from 'node:util';\nconst exec = promisify(execFile);\nasync function isWellFormed(filePath) {\n  try {\n    await exec('ffprobe', ['-v', 'error', filePath]);\n    return true;\n  } catch {\n    return false;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({ src, fields: { tracks: true } });\n} catch (err) {\n  if (err instanceof Error && err.message === 'Expected track type segment') {\n    console.warn('TrackEntry missing TrackType — malformed file:', src);\n    return null;\n  }\n  throw err;\n}","preventionTips":["Run ffprobe on untrusted media before parseMedia to catch malformed headers.","Re-mux corrupt files with ffmpeg so required EBML elements are written.","Reject malformed assets at upload rather than crashing during parse."],"tags":["media-parser","webm","matroska","malformed-input","track-entry"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}