SubtitleEdit/subtitleedit · error · FileNotFoundException

Subtitle file not found: {filePath}

Error message

Subtitle file not found: {filePath}

What it means

Thrown by SubtitleInfoGatherer.Gather (the seconv info command) when the supplied path does not exist on disk. It is a FileNotFoundException, so the message plus the file name are available on the exception.

Source

Thrown at src/seconv/Core/SubtitleInfoGatherer.cs:17

using Nikse.SubtitleEdit.Core.Common;
using Nikse.SubtitleEdit.Core.SubtitleFormats;

namespace SeConv.Core;

/// <summary>
/// Loads a subtitle file and produces a flat <see cref="SubtitleInfo"/> record:
/// path, size, detected format, encoding, paragraph count, total/first/last
/// timecodes, and detected language. Used by <c>seconv info</c>.
/// </summary>
internal static class SubtitleInfoGatherer
{
    public static SubtitleInfo Gather(string filePath)
    {
        if (!File.Exists(filePath))
        {
            throw new FileNotFoundException($"Subtitle file not found: {filePath}");
        }

        var fileSize = new FileInfo(filePath).Length;

        // Detect encoding before format so the displayed encoding is the *source*
        // encoding (not whatever the format used internally).
        var encoding = LanguageAutoDetect.GetEncodingFromFile(filePath);

        var (subtitle, format) = LibSEIntegration.LoadSubtitleWithFormat(filePath);

        long? firstStartMs = null;
        long? lastEndMs = null;
        if (subtitle.Paragraphs.Count > 0)
        {
            firstStartMs = (long)subtitle.Paragraphs[0].StartTime.TotalMilliseconds;
            lastEndMs = (long)subtitle.Paragraphs[^1].EndTime.TotalMilliseconds;
        }

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Verify the path with ls/dir before running; use an absolute path.
  2. Check the shell's working directory for relative paths.
  3. Quote paths containing spaces or special characters.
  4. If using a glob, confirm it expanded to real files.

Example fix

// before
seconv info movei.srt          // typo
// after
seconv info movie.srt
Defensive patterns

Strategy: validation

Validate before calling

if (!File.Exists(filePath))
    throw new FileNotFoundException($"Subtitle file not found: {filePath}", filePath);

Type guard

static bool IsReadableFile(string path) => File.Exists(path);

Try / catch

try { var info = SubtitleInfoGatherer.Gather(path); }
catch (FileNotFoundException ex) { Console.Error.WriteLine(ex.Message); }

Prevention

When it happens

Trigger: Calling seconv info <path> (or SubtitleInfoGatherer.Gather directly) where File.Exists(filePath) is false.

Common situations: Typo in the path, relative path resolved against the wrong working directory, file deleted between glob expansion and processing, or a glob pattern that matched nothing and was passed literally.

Related errors


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