{"record":{"id":"ea75c3622f2069e6","repo":"SubtitleEdit/subtitleedit","slug":"model-file-not-found","errorCode":null,"errorMessage":"Model file not found.","messagePattern":"Model file not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/SpeechToText/Engines/WhisperEngineCpp.cs","lineNumber":141,"sourceCode":"    {\n        var modelFileName = Path.Combine(GetAndCreateWhisperModelFolder(null), modelName);\n        if (Extension.Length > 0 && !modelFileName.EndsWith(Extension))\n        {\n            modelFileName += Extension;\n        }\n\n        return modelFileName;\n    }\n\n    public bool SupportsCustomModels => true;\n\n    public bool CustomModelIsFolder => false;\n\n    public string ImportCustomModel(string sourcePath)\n    {\n        if (!File.Exists(sourcePath))\n        {\n            throw new FileNotFoundException(\"Model file not found.\", sourcePath);\n        }\n\n        if (!sourcePath.EndsWith(\".bin\", StringComparison.OrdinalIgnoreCase))\n        {\n            throw new Exception(\"A whisper.cpp model must be a ggml '.bin' file.\");\n        }\n\n        if (new FileInfo(sourcePath).Length < 10_000_000)\n        {\n            throw new Exception(\"The model file is too small (must be at least 10 MB) - is it really a whisper.cpp model?\");\n        }\n\n        var destination = Path.Combine(GetAndCreateWhisperModelFolder(null), Path.GetFileName(sourcePath));\n        File.Copy(sourcePath, destination, true);\n\n        return Path.GetFileNameWithoutExtension(destination);\n    }\n","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/SpeechToText/Engines/WhisperEngineCpp.cs#L123-L159","documentation":"Thrown by ImportCustomModel when the source path provided for a whisper.cpp custom model does not exist on disk (File.Exists returns false). This is the first validation in the import pipeline: existence check before extension and size validation.","triggerScenarios":"The user selects a file path in the import dialog that no longer exists (deleted between selection and import); the path is a directory instead of a file; the path is a relative path that resolves differently; the file is on a removable drive that was disconnected.","commonSituations":"User typed a path manually instead of using the file picker; the file was moved or deleted after selection; network drive disconnected; permission issue preventing File.Exists from seeing the file; the path contains environment variables that weren't expanded.","solutions":["Use the file picker dialog to select the model file instead of typing a path.","Verify the file exists at the specified path using the OS file explorer.","Check file permissions — ensure the application has read access to the path.","If using a network path, ensure the share is mounted and accessible.","Copy the model file to a local directory before importing."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate before calling ImportCustomModel\nif (!File.Exists(sourcePath))\n    throw new FileNotFoundException($\"Select a valid whisper.cpp model file. The path '{sourcePath}' does not exist.\", sourcePath);","typeGuard":"static bool IsValidWhisperCppModelPath(string path) =>\n    File.Exists(path) &&\n    path.EndsWith(\".bin\", StringComparison.OrdinalIgnoreCase) &&\n    new FileInfo(path).Length >= 10_000_000;","tryCatchPattern":"try { var name = engine.ImportCustomModel(sourcePath); }\ncatch (FileNotFoundException ex)\n{ /* re-prompt user with file picker, show ex.FileName for clarity */ }","preventionTips":["Always use a file picker dialog rather than manual path entry for model selection.","Validate the file exists before passing to ImportCustomModel.","Keep model files on local storage rather than network paths during import."],"tags":["io","file-not-found","whisper","model","validation"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}