remotion-dev/remotion · error · Error
Expected track type segment
Error message
Expected track type segment
What it means
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.
Source
Thrown at packages/media-parser/src/containers/webm/make-track.ts:273
if (codec.value === 'A_MPEG/L3') {
return 'mp3';
}
throw new Error(`Unknown codec: ${codec.value}`);
};
export const getTrack = ({
timescale,
track,
}: {
timescale: number;
track: TrackEntry;
}): MediaParserVideoTrack | MediaParserAudioTrack | null => {
const trackType = getTrackTypeSegment(track);
if (!trackType) {
throw new Error('Expected track type segment');
}
const trackId = getTrackId(track);
if (trackTypeToString(trackType.value.value) === 'video') {
const width = getWidthSegment(track);
if (width === null) {
throw new Error('Expected width segment');
}
const height = getHeightSegment(track);
if (height === null) {
throw new Error('Expected height segment');
}
const displayHeight = getDisplayHeightSegment(track);View on GitHub (pinned to 78fe4bb3fd)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm the file is well-formed before parsing.
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const exec = promisify(execFile);
async function isWellFormed(filePath) {
try {
await exec('ffprobe', ['-v', 'error', filePath]);
return true;
} catch {
return false;
}
} Try / catch
try {
await parseMedia({ src, fields: { tracks: true } });
} catch (err) {
if (err instanceof Error && err.message === 'Expected track type segment') {
console.warn('TrackEntry missing TrackType — malformed file:', src);
return null;
}
throw err;
} Prevention
- 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.
When it happens
Trigger: A TrackEntry element that lacks the `TrackType` child. Caused by truncated/corrupt EBML, non-conformant muxers, or parser mis-segmentation of the Tracks box.
Common situations: 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.
Related errors
- Expected track entry segment
- Expected codec segment
- Expected width segment
- Expected height segment
- Expected av1 private data to be version 1
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/293f3f784db7735f.
Report an issue: GitHub.