SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Operation is not supported on this platform.

Error message

Operation is not supported on this platform.

What it means

Terminal fallback thrown by KokoroTtsCppDownloadService.GetUrl() when the OS is neither Windows nor Linux nor macOS. The method has URLs for Windows, Linux (Arm64 and x64), and macOS, then a bare 'throw new PlatformNotSupportedException()' for anything else (default message 'Operation is not supported on this platform.').

Source

Thrown at src/ui/Logic/Download/KokoroTtsCppDownloadService.cs:114

    private static string GetUrl()
    {
        if (OperatingSystem.IsWindows())
        {
            return WindowsUrl;
        }

        if (OperatingSystem.IsLinux())
        {
            return RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? LinuxArmUrl : LinuxUrl;
        }

        if (OperatingSystem.IsMacOS())
        {
            return MacUrl;
        }

        throw new PlatformNotSupportedException();
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run on Windows, Linux (x64 or ARM64), or macOS where URLs are defined.
  2. If a new OS must be supported, add its branch returning the matching Kokoro build URL.
  3. At the caller, gate Kokoro TTS on the supported OS set and disable gracefully elsewhere.

Example fix

// before (bare throw with default message)
throw new PlatformNotSupportedException();

// after (descriptive message, same behavior)
throw new PlatformNotSupportedException($"Kokoro TTS download is not supported on {RuntimeInformation.OSDescription}.");
Defensive patterns

Strategy: validation

Validate before calling

static bool IsKokoroTtsSupportedPlatform()
    => OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();

if (!IsKokoroTtsSupportedPlatform()) { DisableKokoroTts(); return; }

Type guard

static bool KokoroTtsPlatformSupported()
    => OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();

Try / catch

try { var url = kokoroService.GetUrl(); }
catch (PlatformNotSupportedException)
{ _logger.Warning("Kokoro TTS not supported on {OS}", RuntimeInformation.OSDescription); DisableKokoroTts(); }

Prevention

When it happens

Trigger: Running on an OS where OperatingSystem.IsWindows/IsLinux/IsMacOS all return false — e.g. FreeBSD, a bare-metal/RTOS, or a .NET runtime that doesn't categorize the host. Normal desktop/mobile OSes never reach this.

Common situations: Unsupported host OS; running under an exotic runtime; future OS not yet covered. Practically unreachable on Windows/Linux/macOS, which is the intended support matrix.

Related errors


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