SubtitleEdit/subtitleedit · error · InvalidOperationException
No subtitle tracks in Matroska file: {filePath}
Error message
No subtitle tracks in Matroska file: {filePath} What it means
Thrown when a valid Matroska file contains no subtitle tracks — matroska.GetTracks(true) (subtitle-only filter) returns an empty list. The container is fine but has nothing to extract: only video/audio/data tracks exist.
Source
Thrown at src/seconv/Core/ContainerSubtitleLoader.cs:248
$"MXF contained {subtitleTexts.Count} candidate subtitle essence(s) but none parsed as a known format: {filePath}");
}
return tracks;
}
private static List<LoadedTrack> LoadMatroska(string filePath, ConversionOptions options)
{
var tracks = new List<LoadedTrack>();
using var matroska = new MatroskaFile(filePath);
if (!matroska.IsValid)
{
throw new InvalidOperationException($"Invalid Matroska file: {filePath}");
}
var subtitleTracks = matroska.GetTracks(true);
if (subtitleTracks.Count == 0)
{
throw new InvalidOperationException($"No subtitle tracks in Matroska file: {filePath}");
}
foreach (var track in subtitleTracks)
{
if (options.ForcedOnly && !track.IsForced)
{
continue;
}
if (options.TrackNumbers.Count > 0 && !options.TrackNumbers.Contains(track.TrackNumber))
{
continue;
}
// Image-codec tracks: PGS goes through Tesseract OCR; VobSub deferred.
if (track.CodecId.Equals("S_HDMV/PGS", StringComparison.OrdinalIgnoreCase))
{
try
{View on GitHub (pinned to 17a9f07487)
Solutions
- Check tracks with mkvinfo/ffprobe ('Stream #0:X(subtitle)') to confirm subtitles are absent.
- Provide an external subtitle file (.srt/.ass) instead of the MKV.
- If subtitles should be present, re-mux the original with mkvmerge including the subtitle track.
Defensive patterns
Strategy: validation
Validate before calling
// Check for subtitle tracks before the loader's guard fires.
using var mk = new MatroskaFile(filePath);
if (mk.IsValid && mk.GetTracks(true).Count == 0)
return Error($"No subtitle tracks in {filePath}"); Try / catch
try { tracks = ContainerSubtitleLoader.TryLoadTracks(filePath, options); }
catch (InvalidOperationException ex) when (ex.Message.Contains("No subtitle tracks in Matroska"))
{ Console.Error.WriteLine(ex.Message); return; } Prevention
- Pre-check mk.GetTracks(true) to detect an absent subtitle track early.
- Provide external subtitle files when the MKV has none muxed in.
- Re-mux originals with mkvmerge to include subtitle tracks.
When it happens
Trigger: Loading a .mkv/.mks that has zero tracks flagged as subtitle tracks (ContainerSubtitleLoader.cs:246). Common with video-only releases or MKVs muxed without subtitle tracks.
Common situations: A video-only MKV; a release whose subtitles are in a separate .srt rather than muxed in; an MKV where subtitle tracks were stripped by a re-mux.
Related errors
- No VobSub subtitles in MKV track #{track.TrackNumber}.
- No PGS subtitles in MKV track #{track.TrackNumber}.
- Invalid Matroska file: {filePath}
- No subtitle tracks in MP4 file: {filePath}
- Unable to access bitmap pixel data.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/8410dfd14696c28f.
Report an issue: GitHub.