{"record":{"id":"e1182e25d77f5b7c","repo":"SubtitleEdit/subtitleedit","slug":"subtitle-file-not-found-filepath-e1182e","errorCode":null,"errorMessage":"Subtitle file not found: {filePath}","messagePattern":"Subtitle file not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/SubtitleInfoGatherer.cs","lineNumber":17,"sourceCode":"using Nikse.SubtitleEdit.Core.Common;\nusing Nikse.SubtitleEdit.Core.SubtitleFormats;\n\nnamespace SeConv.Core;\n\n/// <summary>\n/// Loads a subtitle file and produces a flat <see cref=\"SubtitleInfo\"/> record:\n/// path, size, detected format, encoding, paragraph count, total/first/last\n/// timecodes, and detected language. Used by <c>seconv info</c>.\n/// </summary>\ninternal static class SubtitleInfoGatherer\n{\n    public static SubtitleInfo Gather(string filePath)\n    {\n        if (!File.Exists(filePath))\n        {\n            throw new FileNotFoundException($\"Subtitle file not found: {filePath}\");\n        }\n\n        var fileSize = new FileInfo(filePath).Length;\n\n        // Detect encoding before format so the displayed encoding is the *source*\n        // encoding (not whatever the format used internally).\n        var encoding = LanguageAutoDetect.GetEncodingFromFile(filePath);\n\n        var (subtitle, format) = LibSEIntegration.LoadSubtitleWithFormat(filePath);\n\n        long? firstStartMs = null;\n        long? lastEndMs = null;\n        if (subtitle.Paragraphs.Count > 0)\n        {\n            firstStartMs = (long)subtitle.Paragraphs[0].StartTime.TotalMilliseconds;\n            lastEndMs = (long)subtitle.Paragraphs[^1].EndTime.TotalMilliseconds;\n        }\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/SubtitleInfoGatherer.cs#L1-L35","documentation":"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.","triggerScenarios":"Calling seconv info <path> (or SubtitleInfoGatherer.Gather directly) where File.Exists(filePath) is false.","commonSituations":"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.","solutions":["Verify the path with ls/dir before running; use an absolute path.","Check the shell's working directory for relative paths.","Quote paths containing spaces or special characters.","If using a glob, confirm it expanded to real files."],"exampleFix":"// before\nseconv info movei.srt          // typo\n// after\nseconv info movie.srt","handlingStrategy":"validation","validationCode":"if (!File.Exists(filePath))\n    throw new FileNotFoundException($\"Subtitle file not found: {filePath}\", filePath);","typeGuard":"static bool IsReadableFile(string path) => File.Exists(path);","tryCatchPattern":"try { var info = SubtitleInfoGatherer.Gather(path); }\ncatch (FileNotFoundException ex) { Console.Error.WriteLine(ex.Message); }","preventionTips":["Use absolute paths in scripts.","Validate inputs with File.Exists before calling Gather.","Confirm glob patterns actually expanded before forwarding them."],"tags":["seconv","file-not-found","filesystem","cli-input","info-command"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}