SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Unsupported platform for libmpv download. {RuntimeInformatio

Error message

Unsupported platform for libmpv download.
{RuntimeInformation.OSDescription}

What it means

Thrown by LibMpvDownloadService.GetUrl() — currently only Windows (with ARM64 vs x64 selection) returns a URL; macOS and Linux branches are commented out, so any non-Windows OS falls straight to 'throw new PlatformNotSupportedException("Unsupported platform for libmpv download." + Environment.NewLine + RuntimeInformation.OSDescription)'. The OSDescription is appended to aid debugging.

Source

Thrown at src/ui/Logic/Download/LibMpvDownloadService .cs:41

    private const string MacUrlArm = "";

    public LibMpvDownloadService(HttpClient httpClient)
    {
        _httpClient = httpClient;
    }

    private static string GetUrl()
    {
        if (OperatingSystem.IsWindows())
        {
            // A native ARM64 process cannot load an x64 DLL, so the download
            // must match the process architecture (issue #12087).
            return RuntimeInformation.ProcessArchitecture == Architecture.Arm64
                ? WindowsUrlArm
                : WindowsUrl;
        }

        throw new PlatformNotSupportedException("Unsupported platform for libmpv download." + Environment.NewLine +
            RuntimeInformation.OSDescription);

        //if (OperatingSystem.IsMacOS())
        //{
        //    switch (RuntimeInformation.ProcessArchitecture)
        //    {
        //        case Architecture.Arm64:
        //            return MacUrlArm; // e.g., for M1, M2, M3, M4 chips
        //        case Architecture.X64:
        //            return MacUrl;
        //        default:
        //            throw new PlatformNotSupportedException("Unsupported macOS architecture.");
        //    }
        //}

        //throw new PlatformNotSupportedException();
    }

View on GitHub (pinned to 17a9f07487)

Solutions

  1. On macOS/Linux, install libmpv via the OS package manager / Homebrew instead of the auto-download path.
  2. If you need cross-platform auto-download, uncomment and populate the macOS/Linux URL constants with valid libmpv builds.
  3. On Windows, ensure the process architecture matches the binary (ARM64 process gets WindowsUrlArm) — do not force x64 on an ARM64 process.

Example fix

// before: only Windows supported
if (OperatingSystem.IsWindows()) { /* ... */ return RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? WindowsUrlArm : WindowsUrl; }
throw new PlatformNotSupportedException("Unsupported platform for libmpv download." + Environment.NewLine + RuntimeInformation.OSDescription);

// after: restore macOS support
if (OperatingSystem.IsWindows()) { /* ... */ }
if (OperatingSystem.IsMacOS())
{
    return RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? MacUrlArm : MacUrl;
}
throw new PlatformNotSupportedException("Unsupported platform for libmpv download." + Environment.NewLine + RuntimeInformation.OSDescription);
Defensive patterns

Strategy: validation

Validate before calling

static bool IsLibMpvDownloadSupported()
    => OperatingSystem.IsWindows(); // only Windows is wired up

if (!IsLibMpvDownloadSupported()) { UseSystemLibMpvInstall(); return; }

Type guard

static bool LibMpvDownloadSupported() => OperatingSystem.IsWindows();

Try / catch

try { var url = LibMpvDownloadService.GetUrl(); }
catch (PlatformNotSupportedException ex) when (!OperatingSystem.IsWindows())
{ _logger.Warning("libmpv auto-download is Windows-only: {OS}", RuntimeInformation.OSDescription); UseSystemLibMpvInstall(); }

Prevention

When it happens

Trigger: Calling the libmpv download path on macOS or Linux (both branches commented out), or any non-Windows OS. The Windows branch itself selects WindowsUrlArm for Arm64 and WindowsUrl otherwise (issue #12087: native ARM64 process cannot load x64 DLL).

Common situations: Cross-platform build run on macOS/Linux where libmpv download was disabled; a refactor that left only Windows enabled; user expecting Linux/macOS libmpv auto-download. The commented code shows the intended future Mac switch.

Related errors


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