{"record":{"id":"5c098089d994a322","repo":"subhra74/xdm","slug":"youtubedl-executable-not-found","errorCode":null,"errorMessage":"YoutubeDL executable not found","messagePattern":"YoutubeDL executable not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/XDM/XDM.Core/YDLWrapper/YDLProcess.cs","lineNumber":180,"sourceCode":"                    {\r\n                        found = true;\r\n                        binPath = path;\r\n                        break;\r\n                    }\r\n                }\r\n                path = PlatformHelper.FindExecutableFromSystemPath(executableName);\r\n                if (path != null)\r\n                {\r\n                    found = true;\r\n                    binPath = path;\r\n                    break;\r\n                }\r\n            }\r\n            if (found)\r\n            {\r\n                return new YtBinary { BinaryType = GetYtBinaryType(execName!), Path = binPath! };\r\n            }\r\n            throw new FileNotFoundException(\"YoutubeDL executable not found\");\r\n        }\r\n\r\n\r\n        //private void ProcessJson()\r\n        //{\r\n        //    using (StreamReader reader = File.OpenText(@\"C:\\Users\\subhro\\Desktop\\80a44682-5ea8-4193-bc52-34ee568ce9bb.json\"/*JsonOutputFile*/))\r\n        //    {\r\n        //        JObject o = (JObject)JToken.ReadFrom(new JsonTextReader(reader));\r\n        //        o[]\r\n        //    }\r\n        //}\r\n    }\r\n}\r\n","sourceCodeStart":162,"sourceCodeEnd":194,"githubUrl":"https://github.com/subhra74/xdm/blob/1ca5a25aae007826c859c81bea494e7c102e1242/app/XDM/XDM.Core/YDLWrapper/YDLProcess.cs#L162-L194","documentation":"YDLProcess.FindYDLBinary searches known locations and PATH for a youtube-dl or yt-dlp executable (including python-hosted variants). If no candidate binary is found it throws FileNotFoundException with this message. It is called by exec before any ydl operation can run, so it fails fast when the external tool is absent.","triggerScenarios":"Running any youtube-dl-backed operation when neither youtube-dl nor yt-dlp exists in the app's expected directories or on the system PATH — e.g. fresh install without the bundled binary, binary deleted by antivirus, or a minimal environment (server/CI) where the tool was never installed.","commonSituations":"Fresh machine or Docker image missing yt-dlp; antivirus quarantined youtube-dl.exe; PATH not containing Python Scripts directory for pip-installed yt-dlp; app deployed without bundling the executable; wrong architecture binary that fails discovery.","solutions":["Install yt-dlp (e.g. 'pip install yt-dlp' or download yt-dlp.exe) and ensure its location is on PATH.","Place the yt-dlp/youtube-dl executable in the application's expected binary directory (bundled location checked by FindYDLBinary).","If installed via pip, confirm the Python Scripts folder is on PATH and 'yt-dlp --version' works in a shell.","Check antivirus quarantine and whitelist the binary if it was removed.","Catch FileNotFoundException around ydl operations and prompt the user to install/update the downloader."],"exampleFix":"// before\nvar info = YDLHelper.GetVideoInfo(url); // FileNotFound if yt-dlp absent\n\n// after\ntry\n{\n    var info = YDLHelper.GetVideoInfo(url);\n}\ncatch (FileNotFoundException)\n{\n    Console.WriteLine(\"Install yt-dlp and ensure it is on PATH.\");\n    throw;\n}","handlingStrategy":"validation","validationCode":"static bool YdlAvailable()\n{\n    foreach (var name in new[] { \"yt-dlp\", \"youtube-dl\" })\n    {\n        var paths = Environment.GetEnvironmentVariable(\"PATH\")\n            .Split(Path.PathSeparator);\n        foreach (var dir in paths)\n        {\n            var p = Path.Combine(dir, name + (OperatingSystem.IsWindows() ? \".exe\" : \"\"));\n            if (File.Exists(p)) return true;\n        }\n    }\n    return false;\n}","typeGuard":null,"tryCatchPattern":"try { return YDLProcess.Exec(args); }\ncatch (FileNotFoundException ex) when (ex.Message == \"YoutubeDL executable not found\")\n{ throw new MissingDependencyException(\"Install yt-dlp and add it to PATH\", ex); }","preventionTips":["Install yt-dlp on PATH (pip install yt-dlp) before using ydl features","Bundle yt-dlp with the application where licensing permits","Check antivirus quarantine if the binary disappears","Run 'yt-dlp --version' as a startup health check"],"tags":["youtube-dl","missing-dependency","external-process","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"1ca5a25aae007826c859c81bea494e7c102e1242","analyzedAt":"2026-09-13T20:37:40.968Z","contentChangedAt":"2026-09-13T20:37:40.968Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}