{"record":{"id":"0266f88fa1a22819","repo":"SubtitleEdit/subtitleedit","slug":"google-lens-ocr-is-not-available-for-linux-arm64","errorCode":null,"errorMessage":"Google Lens OCR is not available for Linux ARM64.","messagePattern":"Google Lens OCR is not available for Linux ARM64\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ui/Logic/Download/GoogleLensOcrDownloadService.cs","lineNumber":44,"sourceCode":"    }\n\n    public async Task DownloadGoogleLensOcrStandalone(Stream stream, IProgress<float>? progress, CancellationToken cancellationToken)\n    {\n        await DownloadHelper.DownloadFileAsync(httpClient, GetUrl(), stream, progress, cancellationToken);\n    }\n\n    private string GetUrl()\n    {\n        if (OperatingSystem.IsWindows())\n        {\n            return WindowsUrl;\n        }\n\n        if (OperatingSystem.IsLinux())\n        {\n            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)\n            {\n                throw new PlatformNotSupportedException(\"Google Lens OCR is not available for Linux ARM64.\");\n            }\n\n            return LinuxUrl;\n        }\n\n        throw new PlatformNotSupportedException(\"Google Lens OCR does not support this platform\");\n    }\n}","sourceCodeStart":26,"sourceCodeEnd":52,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/GoogleLensOcrDownloadService.cs#L26-L52","documentation":"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.","triggerScenarios":"Calling the Google Lens OCR download path on Linux where RuntimeInformation.ProcessArchitecture == Architecture.Arm64: Raspberry Pi, Graviton VMs, ARM Linux containers, Ampere Altra servers.","commonSituations":"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.","solutions":["Run the app on Linux x64 or Windows for Google Lens OCR support.","At the caller, detect Linux+ARM64 and disable the Google Lens OCR feature gracefully.","Provide an ARM64-built Google Lens OCR binary out-of-band and bypass GetUrl()."],"exampleFix":"// before\nvar url = googleLensService.GetUrl();\n\n// after\nif (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)\n{\n    DisableGoogleLensOcrFeature();\n    return;\n}\nvar url = googleLensService.GetUrl();","handlingStrategy":"validation","validationCode":"static bool IsGoogleLensOcrSupported()\n    => OperatingSystem.IsWindows()\n       || (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture != Architecture.Arm64);\n\nif (!IsGoogleLensOcrSupported()) { DisableGoogleLensOcr(); return; }","typeGuard":"static bool GoogleLensOcrSupported()\n    => OperatingSystem.IsWindows()\n       || (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture != Architecture.Arm64);","tryCatchPattern":"try { var url = googleLensService.GetUrl(); }\ncatch (PlatformNotSupportedException ex) when (ex.Message.Contains(\"Linux ARM64\"))\n{ _logger.Warning(\"Google Lens OCR disabled on Linux ARM64.\"); DisableGoogleLensOcr(); }","preventionTips":["Disable Google Lens OCR in the UI for Linux ARM64 deployments.","Log OS+arch at startup to catch misclassified environments.","Track which OCR engines are ARM64-Linux-ready when planning ARM deployments."],"tags":["platform","arm64","linux","google-lens","ocr","download"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}