{"record":{"id":"e0823269f8c42aad","repo":"Tyrrrz/YoutubeDownloader","slug":"unsupported-operating-system","errorCode":null,"errorMessage":"Unsupported operating system.","messagePattern":"Unsupported operating system\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"error","filePath":"YoutubeDownloader.Core/Downloading/FFmpeg.cs","lineNumber":88,"sourceCode":"        GetProbeDirectoryPaths()\n            .Distinct(StringComparer.Ordinal)\n            .Select(dirPath => Path.Combine(dirPath, CliFileName))\n            .FirstOrDefault(File.Exists);\n\n    private static string GetDownloadUrl()\n    {\n        static string GetSystemMoniker()\n        {\n            if (OperatingSystem.IsWindows())\n                return \"windows\";\n\n            if (OperatingSystem.IsLinux())\n                return \"linux\";\n\n            if (OperatingSystem.IsMacOS())\n                return \"osx\";\n\n            throw new PlatformNotSupportedException(\"Unsupported operating system.\");\n        }\n\n        static string GetArchitectureMoniker()\n        {\n            if (RuntimeInformation.ProcessArchitecture == Architecture.X64)\n                return \"x64\";\n\n            if (RuntimeInformation.ProcessArchitecture == Architecture.X86)\n                return \"x86\";\n\n            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)\n                return \"arm64\";\n\n            throw new PlatformNotSupportedException(\n                $\"Unsupported architecture: {RuntimeInformation.ProcessArchitecture}.\"\n            );\n        }\n","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/Tyrrrz/YoutubeDownloader/blob/bbcff039515a2ac985e3769f0243a58645a52b28/YoutubeDownloader.Core/Downloading/FFmpeg.cs#L70-L106","documentation":"Thrown by the local GetSystemMoniker() inside FFmpeg.GetDownloadUrl() while auto-provisioning the FFmpeg binary. The library downloads a prebuilt FFmpeg from github.com/Tyrrrz/FFmpegBin (URL built at FFmpeg.cs:110) and only ships assets for Windows, Linux, and macOS; any other OS cannot be mapped to a release-asset suffix, so the URL cannot be constructed and PlatformNotSupportedException is thrown.","triggerScenarios":"Calling FFmpeg.DownloadAsync(...) on a runtime where OperatingSystem.IsWindows(), IsLinux(), and IsMacOS() all return false (e.g. FreeBSD, Solaris). It is only reached when no FFmpeg was found by TryGetCliFilePath() and the caller falls through to auto-download.","commonSituations":"Running under Wine/Proton or a translation layer that reports a non-standard OS; niche containers/distros; new .NET platforms added later. Note TryGetCliFilePath() probes AppContext.BaseDirectory, the current directory, and PATH (plus registry PATH on Windows), so a system FFmpeg avoids this path entirely.","solutions":["Install FFmpeg and make it resolvable via PATH (or place it in AppContext.BaseDirectory) so TryGetCliFilePath() returns a path and DownloadAsync is never called.","Pass ffmpegPath explicitly to VideoDownloader.DownloadVideoAsync(...) to bypass auto-download (FFmpeg.cs:77 falls back to it).","If you must support the platform, extend GetSystemMoniker() with the OS moniker and ensure a matching asset exists in the FFmpegBin release at Version (currently \"8.1\")."],"exampleFix":"// before: relies on auto-download, which throws on unsupported OS\nawait FFmpeg.DownloadAsync(outputPath, progress, ct);\n\n// after: only auto-download on supported platforms, otherwise require a system binary\nvar ffmpeg = FFmpeg.TryGetCliFilePath();\nif (ffmpeg is null)\n{\n    if (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS())\n        throw new InvalidOperationException(\"Install FFmpeg manually on this OS.\");\n    await FFmpeg.DownloadAsync(outputPath, progress, ct);\n    ffmpeg = outputPath;\n}","handlingStrategy":"validation","validationCode":"static bool IsFfmpegAutoDownloadSupported() =>\n    OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();\n\n// before calling FFmpeg.DownloadAsync:\nif (!IsFfmpegAutoDownloadSupported() && FFmpeg.TryGetCliFilePath() is null)\n{\n    // instruct the user to install FFmpeg manually instead of auto-downloading\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await FFmpeg.DownloadAsync(outputPath, progress, ct);\n}\ncatch (PlatformNotSupportedException ex) when (ex.Message == \"Unsupported operating system.\")\n{\n    // prompt the user to install FFmpeg in PATH, or accept an explicit ffmpegPath\n}","preventionTips":["Ship or require a system FFmpeg so TryGetCliFilePath() resolves before any auto-download.","Gate the auto-download call behind an OS-capability check and surface a friendly message.","Accept an explicit ffmpegPath from the user/config so the download path is optional."],"tags":["platform","ffmpeg","os-detection","runtime","provisioning"],"backgroundTag":null,"analyzedSha":"bbcff039515a2ac985e3769f0243a58645a52b28","analyzedAt":"2026-08-13T14:28:37.801Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}