SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Google Lens OCR does not support this platform

Error message

Google Lens OCR does not support this platform

What it means

Terminal fallback thrown by GoogleLensOcrDownloadService.GetUrl() when the OS is neither Windows nor Linux. The service has URLs only for Windows and Linux x64; macOS and any other OS fall through to this catch-all PlatformNotSupportedException.

Source

Thrown at src/ui/Logic/Download/GoogleLensOcrDownloadService.cs:50

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

        if (OperatingSystem.IsLinux())
        {
            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
            {
                throw new PlatformNotSupportedException("Google Lens OCR is not available for Linux ARM64.");
            }

            return LinuxUrl;
        }

        throw new PlatformNotSupportedException("Google Lens OCR does not support this platform");
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Use Google Lens OCR only on Windows or Linux x64.
  2. Disable the feature on macOS/unsupported OSes at the UI/caller level before invoking GetUrl().
  3. If macOS support is needed, obtain a macOS-compatible Google Lens OCR build and wire a MacUrl into the method.

Example fix

// before
var url = googleLensService.GetUrl(); // throws on macOS

// after
if (!OperatingSystem.IsWindows() && !(OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture != Architecture.Arm64))
{
    DisableGoogleLensOcrFeature();
    return;
}
var url = googleLensService.GetUrl();
Defensive patterns

Strategy: validation

Validate before calling

static bool IsGoogleLensOcrSupportedPlatform()
    => OperatingSystem.IsWindows()
       || (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture != Architecture.Arm64);

if (!IsGoogleLensOcrSupportedPlatform()) { DisableGoogleLensOcr(); return; }

Type guard

static bool GoogleLensOcrPlatformSupported()
    => OperatingSystem.IsWindows()
       || (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture != Architecture.Arm64);

Try / catch

try { var url = googleLensService.GetUrl(); }
catch (PlatformNotSupportedException ex) when (ex.Message.Contains("does not support this platform"))
{ _logger.Warning("Google Lens OCR not supported on {OS}", RuntimeInformation.OSDescription); DisableGoogleLensOcr(); }

Prevention

When it happens

Trigger: OperatingSystem.IsMacOS() is true (or FreeBSD/other) and the caller asks for a Google Lens OCR URL. macOS has no URL constant defined, so it reaches the final throw.

Common situations: Mac users attempting Google Lens OCR; unsupported OSes (FreeBSD, etc.); running under a non-Windows/Linux container. This is the platform gate that keeps macOS users from a downstream FileNotFoundException.

Related errors


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