SubtitleEdit/subtitleedit · error · InvalidOperationException

No subtitles found in file: {inputFile}

Error message

No subtitles found in file: {inputFile}

What it means

Thrown when LibSEIntegration.LoadSubtitleWithFormat returns a null Subtitle or one with zero paragraphs for a text-subtitle input. LibSE loaded the file but found no recognisable cue lines, so there is nothing to convert or save.

Source

Thrown at src/seconv/Core/SubtitleConverter.cs:645

            await Task.Run(async () =>
            {
                // --encoding:source means "use the input file's detected encoding for both
                // read and write". Resolve it per-file before the load so the same encoding
                // name flows into the save side too.
                var resolvedOptions = options;
                if (LibSEIntegration.IsSourceEncodingSentinel(options.Encoding))
                {
                    var detected = LibSEIntegration.DetectSourceEncodingName(inputFile, options.InputEncodingFallback);
                    resolvedOptions = options with { Encoding = detected };
                }

                // Load subtitle file using LibSE — keep the detected format so the
                // save side can apply RemoveNativeFormatting when the target differs.
                var (subtitle, sourceFormat) = LibSEIntegration.LoadSubtitleWithFormat(inputFile, resolvedOptions.Encoding, resolvedOptions.InputEncodingFallback, warnings);

                if (subtitle == null || subtitle.Paragraphs.Count == 0)
                {
                    throw new InvalidOperationException($"No subtitles found in file: {inputFile}");
                }

                await ApplyTransformsAndSaveAsync(subtitle, sourceFormat, outputFile, resolvedOptions);
            });
        }
        finally
        {
            Configuration.Settings.General.CurrentFrameRate = originalFrameRate;
        }
    }

    private async Task ConvertTrackAsync(ContainerSubtitleLoader.LoadedTrack track, string outputFile, ConversionOptions options)
    {
        var originalFrameRate = Configuration.Settings.General.CurrentFrameRate;
        try
        {
            if (options.Fps.HasValue)
            {

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Open the file in a text editor and confirm it contains real cue entries (index, timecode, text).
  2. If encoding was misdetected, pass --encoding <codepage> (or --input-encoding-fallback) so the parser reads the bytes correctly.
  3. If the file is image/binary based, use the bitmap/OCR path rather than the text loader.
  4. Verify the file is not truncated/corrupt — re-export from the original source.

Example fix

// before
seconv blank.srt srt
// after (force correct encoding)
seconv windows-1252.srt srt --encoding windows-1252
Defensive patterns

Strategy: validation

Validate before calling

var (sub, _) = LibSEIntegration.LoadSubtitleWithFormat(inputFile, encoding, fallback, warnings);
if (sub is null || sub.Paragraphs.Count == 0)
    throw new ArgException($"'{inputFile}' has no recognisable subtitle cues (wrong format/encoding?).");

Type guard

static bool HasCues(Subtitle? s) => s is { Paragraphs.Count: > 0 };

Try / catch

null

Prevention

When it happens

Trigger: ConvertFileAsync loads inputFile (a text subtitle), and subtitle == null || subtitle.Paragraphs.Count == 0 after format detection and (optional) source-encoding resolution.

Common situations: Pointing seconv at an empty .srt, a file with only a header/metadata but no cues, a binary/image file mistaken for text, or a file whose encoding was mis-detected so the parser saw garbage. A genuinely blank subtitle export.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/445a3c5311ba0660. Report an issue: GitHub.