{"record":{"id":"7bb8c0431c58b2f4","repo":"SubtitleEdit/subtitleedit","slug":"llama-cpp-cuda-build-is-not-available-for-linux-ar","errorCode":null,"errorMessage":"llama.cpp CUDA build is not available for Linux ARM64.","messagePattern":"llama\\.cpp CUDA build is not available for Linux ARM64\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ui/Logic/Download/LlamaCppDownloadService.cs","lineNumber":114,"sourceCode":"    {\n        if (OperatingSystem.IsWindows())\n        {\n            return variant switch\n            {\n                VariantCuda => BaseUrl + \"llama-\" + ReleaseTag + \"-bin-win-cuda-12.4-x64.zip\",\n                VariantCuda13 => BaseUrl + \"llama-\" + ReleaseTag + \"-bin-win-cuda-13.3-x64.zip\",\n                VariantVulkan => BaseUrl + \"llama-\" + ReleaseTag + \"-bin-win-vulkan-x64.zip\",\n                _ => BaseUrl + \"llama-\" + ReleaseTag + \"-bin-win-cpu-x64.zip\",\n            };\n        }\n\n        if (OperatingSystem.IsLinux())\n        {\n            if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)\n            {\n                if (variant == VariantCuda)\n                {\n                    throw new PlatformNotSupportedException(\"llama.cpp CUDA build is not available for Linux ARM64.\");\n                }\n\n                return variant == VariantVulkan\n                    ? BaseUrl + \"llama-\" + ReleaseTag + \"-bin-ubuntu-vulkan-arm64.tar.gz\"\n                    : BaseUrl + \"llama-\" + ReleaseTag + \"-bin-ubuntu-arm64.tar.gz\";\n            }\n\n            return variant == VariantVulkan\n                ? BaseUrl + \"llama-\" + ReleaseTag + \"-bin-ubuntu-vulkan-x64.tar.gz\"\n                : BaseUrl + \"llama-\" + ReleaseTag + \"-bin-ubuntu-x64.tar.gz\";\n        }\n\n        if (OperatingSystem.IsMacOS())\n        {\n            return RuntimeInformation.ProcessArchitecture == Architecture.Arm64\n                ? BaseUrl + \"llama-\" + ReleaseTag + \"-bin-macos-arm64.tar.gz\"\n                : BaseUrl + \"llama-\" + ReleaseTag + \"-bin-macos-x64.tar.gz\";\n        }","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/LlamaCppDownloadService.cs#L96-L132","documentation":"Thrown by LlamaCppDownloadService when on Linux with ProcessArchitecture == Architecture.Arm64 AND the requested variant is the CUDA build. llama.cpp CUDA binaries are not built for Linux ARM64, so the service refuses with PlatformNotSupportedException. Vulkan and CPU variants on Linux ARM64 are still available (the same code path returns those URLs just below the throw).","triggerScenarios":"On Linux ARM64 (Graviton, Pi, Ampere, ARM containers) calling the download with variant == VariantCuda (or VariantCuda13). The guard runs before URL construction so no CUDA URL is ever returned. Switching to VariantVulkan or the default CPU variant avoids it.","commonSituations":"User/app selected the CUDA accelerator on an ARM64 Linux box where no CUDA llama.cpp build exists; default accelerator fell back to CUDA on a Graviton instance; misconfigured variant picker that doesn't account for arch.","solutions":["On Linux ARM64, select the Vulkan or CPU variant instead of CUDA when downloading llama.cpp.","At the UI/accelerator-picker level, disable the CUDA option when IsLinux() && ProcessArchitecture == Arm64.","If CUDA on ARM64 is mandatory, build llama.cpp yourself for that target and bypass this download path."],"exampleFix":"// before\nvar variant = VariantCuda; // throws on linux arm64\nawait llamaService.DownloadEngine(stream, variant, progress, ct);\n\n// after: pick a supported variant on linux arm64\nvar variant = (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64)\n    ? LlamaCppDownloadService.VariantVulkan\n    : VariantCuda;\nawait llamaService.DownloadEngine(stream, variant, progress, ct);","handlingStrategy":"validation","validationCode":"// Reject CUDA variant on Linux ARM64 before calling the downloader\nstatic string PickLlamaVariant(string desired)\n    => (OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64\n        && desired is LlamaCppDownloadService.VariantCuda or LlamaCppDownloadService.VariantCuda13)\n        ? LlamaCppDownloadService.VariantVulkan\n        : desired;","typeGuard":"static bool LlamaCudaSupportedOnHost()\n    => !(OperatingSystem.IsLinux() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64);","tryCatchPattern":"try { await llamaService.DownloadEngine(stream, VariantCuda, progress, ct); }\ncatch (PlatformNotSupportedException ex) when (ex.Message.Contains(\"CUDA build is not available for Linux ARM64\"))\n{ _logger.Warning(\"Falling back to Vulkan on Linux ARM64.\"); stream.SetLength(0); await llamaService.DownloadEngine(stream, VariantVulkan, progress, ct); }","preventionTips":["Disable the CUDA accelerator option in the UI when IsLinux() && Arm64.","Default to Vulkan/CPU on ARM64 Linux deployments.","Document variant availability per platform near the picker."],"tags":["platform","arm64","linux","cuda","llama-cpp","variant","download"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}