SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Unsupported macOS architecture.

Error message

Unsupported macOS architecture.

What it means

Thrown by the default case of the macOS architecture switch in ChatLlmDownloadService.GetUrl(). The switch only handles Architecture.Arm64 (the X64 case is commented out), so any other architecture on macOS (notably Intel x64 Macs, or exotic runtimes) hits the default. This is a PlatformNotSupportedException signalling that no build URL exists for that combination.

Source

Thrown at src/ui/Logic/Download/ChatLlmDownloadService.cs:76

        {
            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
            {
                throw new PlatformNotSupportedException("ChatLLM 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, M5 chips
                // case Architecture.X64:
                //     return MacX64Url;
                default:
                    throw new PlatformNotSupportedException("Unsupported macOS architecture.");
            }
        }
        throw new PlatformNotSupportedException();
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run on an Apple Silicon (Arm64) Mac, which is the only macOS path currently wired up.
  2. If you must support Intel Macs, uncomment and supply a MacX64Url constant plus the matching ChatLLM build, then handle the X64 case.
  3. At the caller, gate the ChatLLM feature on RuntimeInformation.ProcessArchitecture == Architecture.Arm64 before invoking GetUrl() so Intel Mac users get a clean disabled-state instead of an exception.

Example fix

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

// after - restore Intel Mac support
switch (RuntimeInformation.ProcessArchitecture)
{
    case Architecture.Arm64: return MacArmUrl;
    case Architecture.X64:   return MacX64Url;
    default: throw new PlatformNotSupportedException("Unsupported macOS architecture.");
}
Defensive patterns

Strategy: validation

Validate before calling

// Only Apple Silicon is wired up for ChatLLM on macOS
static bool IsChatLlmSupportedOnMac()
    => !OperatingSystem.IsMacOS()
       || RuntimeInformation.ProcessArchitecture == Architecture.Arm64;

if (!IsChatLlmSupportedOnMac()) { DisableChatLlmFeature(); return; }

Type guard

static bool ChatLlmMacSupported()
    => !OperatingSystem.IsMacOS()
       || RuntimeInformation.ProcessArchitecture == Architecture.Arm64;

Try / catch

try { var url = ChatLlmDownloadService.GetUrl(); }
catch (PlatformNotSupportedException ex) when (OperatingSystem.IsMacOS() && ex.Message.Contains("macOS architecture"))
{ _logger.Warning("ChatLLM disabled on this Mac: {Arch}", RuntimeInformation.ProcessArchitecture); DisableChatLlmFeature(); }

Prevention

When it happens

Trigger: Running on macOS where ProcessArchitecture is neither Arm64 nor an explicitly handled case — primarily Intel (x64) Macs, since the X64 branch is commented out. Also reachable on macOS under Rosetta-reported x64 or any Architecture enum value outside Arm64.

Common situations: Intel Mac users (pre-2020 hardware); Rosetta-translated .NET process reporting X64; a future Architecture value (e.g. LoongArch64) the switch does not know. The commented-out X64 branch is the smoking gun — the URL was disabled.

Related errors


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