{"record":{"id":"8410dfd14696c28f","repo":"SubtitleEdit/subtitleedit","slug":"no-subtitle-tracks-in-matroska-file-filepath","errorCode":null,"errorMessage":"No subtitle tracks in Matroska file: {filePath}","messagePattern":"No subtitle tracks in Matroska file: (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/ContainerSubtitleLoader.cs","lineNumber":248,"sourceCode":"                $\"MXF contained {subtitleTexts.Count} candidate subtitle essence(s) but none parsed as a known format: {filePath}\");\n        }\n\n        return tracks;\n    }\n\n    private static List<LoadedTrack> LoadMatroska(string filePath, ConversionOptions options)\n    {\n        var tracks = new List<LoadedTrack>();\n        using var matroska = new MatroskaFile(filePath);\n        if (!matroska.IsValid)\n        {\n            throw new InvalidOperationException($\"Invalid Matroska file: {filePath}\");\n        }\n\n        var subtitleTracks = matroska.GetTracks(true);\n        if (subtitleTracks.Count == 0)\n        {\n            throw new InvalidOperationException($\"No subtitle tracks in Matroska file: {filePath}\");\n        }\n\n        foreach (var track in subtitleTracks)\n        {\n            if (options.ForcedOnly && !track.IsForced)\n            {\n                continue;\n            }\n            if (options.TrackNumbers.Count > 0 && !options.TrackNumbers.Contains(track.TrackNumber))\n            {\n                continue;\n            }\n\n            // Image-codec tracks: PGS goes through Tesseract OCR; VobSub deferred.\n            if (track.CodecId.Equals(\"S_HDMV/PGS\", StringComparison.OrdinalIgnoreCase))\n            {\n                try\n                {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/ContainerSubtitleLoader.cs#L230-L266","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check for subtitle tracks before the loader's guard fires.\nusing var mk = new MatroskaFile(filePath);\nif (mk.IsValid && mk.GetTracks(true).Count == 0)\n    return Error($\"No subtitle tracks in {filePath}\");","typeGuard":null,"tryCatchPattern":"try { tracks = ContainerSubtitleLoader.TryLoadTracks(filePath, options); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No subtitle tracks in Matroska\"))\n{ Console.Error.WriteLine(ex.Message); return; }","preventionTips":["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."],"tags":["matroska","mkv","no-tracks","subtitle"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}