SubtitleEdit/subtitleedit · critical · PlatformNotSupportedException

Google Lens OCR is not available for Linux ARM64.

Error message

Google Lens OCR is not available for Linux ARM64.

What it means

Thrown by GoogleLensOcrDownloadService.GetUrl() when on Linux with an ARM64 CPU. The Google Lens OCR binaries are only published for Linux x64 (plus Windows), so the service refuses on ARM64 Linux rather than returning a URL it cannot honor. PlatformNotSupportedException marks the operation as unavailable on this platform.

Source

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

    }

    public async Task DownloadGoogleLensOcrStandalone(Stream stream, IProgress<float>? progress, CancellationToken cancellationToken)
    {
        await DownloadHelper.DownloadFileAsync(httpClient, GetUrl(), stream, progress, cancellationToken);
    }

    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. Run the app on Linux x64 or Windows for Google Lens OCR support.
  2. At the caller, detect Linux+ARM64 and disable the Google Lens OCR feature gracefully.
  3. Provide an ARM64-built Google Lens OCR binary out-of-band and bypass GetUrl().

Example fix

// before
var url = googleLensService.GetUrl();

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

Strategy: validation

Validate before calling

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

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

Type guard

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

Try / catch

try { var url = googleLensService.GetUrl(); }
catch (PlatformNotSupportedException ex) when (ex.Message.Contains("Linux ARM64"))
{ _logger.Warning("Google Lens OCR disabled on Linux ARM64."); DisableGoogleLensOcr(); }

Prevention

When it happens

Trigger: Calling the Google Lens OCR download path on Linux where RuntimeInformation.ProcessArchitecture == Architecture.Arm64: Raspberry Pi, Graviton VMs, ARM Linux containers, Ampere Altra servers.

Common situations: Running on a Pi/SBC; deploying to ARM cloud instances; arm64 .NET runtime installed; CI on ARM Linux. Distinct from 330 (which covers macOS/other) — this specifically guards the Linux ARM64 case.

Related errors


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