{"record":{"id":"4441b290710b64f2","repo":"SubtitleEdit/subtitleedit","slug":"mxf-contained-subtitletexts-count-essence-s-but","errorCode":null,"errorMessage":"MXF contained {subtitleTexts.Count} essence(s) but none matched --track-number ({string.Join(\",\", options.TrackNumbers)}): {filePath}","messagePattern":"MXF contained (.+?) essence\\(s\\) but none matched --track-number \\((.+?)\\): (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/ContainerSubtitleLoader.cs","lineNumber":226,"sourceCode":"            if (format == null || subtitle.Paragraphs.Count == 0)\n            {\n                AnsiConsole.MarkupLine(\n                    $\"[yellow]Warning: MXF essence #{trackNumber} doesn't parse as a known subtitle format; skipped.[/]\");\n                trackNumber++;\n                continue;\n            }\n            subtitle.Renumber();\n            // Use \"mxf_track{n}\" as the language-suffix slot so multi-track MXFs produce\n            // stably-named outputs (mirrors the teletext_<page> / dvb_pid<n> conventions).\n            tracks.Add(new LoadedTrack(subtitle, format, $\"mxf_track{trackNumber}\", trackNumber));\n            trackNumber++;\n        }\n\n        if (tracks.Count == 0)\n        {\n            if (options.TrackNumbers.Count > 0)\n            {\n                throw new InvalidOperationException(\n                    $\"MXF contained {subtitleTexts.Count} essence(s) but none matched --track-number ({string.Join(\",\", options.TrackNumbers)}): {filePath}\");\n            }\n            throw new InvalidOperationException(\n                $\"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","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/ContainerSubtitleLoader.cs#L208-L244","documentation":"Thrown when an MXF contains subtitle essences but none of them matched the track numbers requested via ConversionOptions.TrackNumbers. The filter 'options.TrackNumbers.Contains(trackNumber)' excluded every essence, leaving the tracks list empty. The message reports how many essences were present and which numbers were requested.","triggerScenarios":"Passing --track-number with values that do not correspond to any MXF essence number. The loop at ContainerSubtitleLoader.cs:213 increments trackNumber per essence; if none of those numbers intersect options.TrackNumbers, the post-loop guard at line 222 fires.","commonSituations":"User assumes 1-based or 0-based numbering that differs from the loader's internal count; an MXF with fewer essences than the requested number; a typo in the --track-number argument.","solutions":["List the MXF's subtitle essences (ffprobe / parser.GetSubtitles count) to find valid numbers.","Use the correct 1-based essence index that matches the loader's numbering.","Omit --track-number to convert all essences, then select the desired output."],"exampleFix":"// before\nseconv movie.mxf --track-number 3   # MXF only has 1-2 essences\n\n// after\nseconv movie.mxf --track-number 2   # valid 1-based essence number","handlingStrategy":"validation","validationCode":"// Before requesting specific tracks, confirm they exist.\n// (Track count is internal; omit --track-number to accept all, or list essences first.)\nif (options.TrackNumbers.Count > 0) {\n    // Ensure requested numbers are plausible; otherwise convert all.\n}","typeGuard":null,"tryCatchPattern":"try { tracks = ContainerSubtitleLoader.TryLoadTracks(mxfPath, options); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"--track-number\"))\n{ options.TrackNumbers.Clear(); tracks = ContainerSubtitleLoader.TryLoadTracks(mxfPath, options); }  // retry all","preventionTips":["List the MXF's subtitle essences first to discover valid 1-based track numbers.","Omit --track-number to convert every essence when unsure.","On the error, retry without the filter to recover gracefully."],"tags":["mxf","track-number","filter","subtitle"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}