SubtitleEdit/subtitleedit · error · PlatformNotSupportedException

Unsupported macOS architecture.

Error message

Unsupported macOS architecture.

What it means

Thrown by GetUrl inside the macOS architecture switch's default case. The switch handles Arm64 (M-series) and X64 (Intel) Macs, so any other ProcessArchitecture value (e.g. a future RISC-V/LoongArch port, or an unexpected value) hits this throw. It is narrower than the other macOS checks because the OS branch already matched.

Source

Thrown at src/ui/Logic/Download/WhisperDownloadService.cs:166

        {
            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
            {
                throw new PlatformNotSupportedException("whisper.cpp Vulkan build is not available for Linux ARM64.");
            }

            return LinuxUrl;
        }

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

        throw new PlatformNotSupportedException();
    }

    private static string GetUrlCuBlas()
    {
        if (OperatingSystem.IsWindows())
        {
            return WindowsUrlCuBlass;
        }

        if (OperatingSystem.IsLinux())
        {
            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
            {
                throw new PlatformNotSupportedException("whisper.cpp CUDA build is not available for Linux ARM64.");

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run on a mainstream macOS arch (Apple Silicon or Intel) where MacArmUrl/MacX64Url apply.
  2. Add a case for the new architecture in the switch and point it at a matching build.
  3. Fall back to the X64 build under Rosetta for unknown Apple architectures instead of throwing.

Example fix

// before
switch (RuntimeInformation.ProcessArchitecture)
{
    case Architecture.Arm64: return MacArmUrl;
    case Architecture.X64: return MacX64Url;
    default: throw new PlatformNotSupportedException("Unsupported macOS architecture.");
}

// after: Rosetta fallback for unknown arch
switch (RuntimeInformation.ProcessArchitecture)
{
    case Architecture.Arm64: return MacArmUrl;
    case Architecture.X64:
    default: return MacX64Url; // runs under Rosetta on Apple Silicon if needed
}
Defensive patterns

Strategy: try-catch

Validate before calling

var arch = RuntimeInformation.ProcessArchitecture;
if (OperatingSystem.IsMacOS() && arch != Architecture.Arm64 && arch != Architecture.X64)
{ /* unsupported macOS arch */ }

Type guard

static bool IsSupportedMacArch() =>
    !OperatingSystem.IsMacOS() ||
    RuntimeInformation.ProcessArchitecture is Architecture.Arm64 or Architecture.X64;

Try / catch

try { await svc.DownloadWhisperCpp(stream, progress, ct); }
catch (PlatformNotSupportedException ex) when (ex.Message.Contains("macOS architecture"))
{ /* fall back to MacX64Url under Rosetta */ }

Prevention

When it happens

Trigger: Calling DownloadWhisperCpp on macOS where RuntimeInformation.ProcessArchitecture is neither Arm64 nor X64 (e.g. a custom .NET runtime reporting Architecture.Wasm/Arm/x86).

Common situations: Rare on stock hardware; seen with non-standard .NET runtimes, emulated environments, or future CPU architectures not yet in the switch.

Related errors


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