{"record":{"id":"1950819a20b027b0","repo":"SubtitleEdit/subtitleedit","slug":"operation-is-not-supported-on-this-platform","errorCode":null,"errorMessage":"Operation is not supported on this platform.","messagePattern":"Operation is not supported on this platform\\.","errorType":"exception","errorClass":"PlatformNotSupportedException","httpStatus":null,"severity":"critical","filePath":"src/ui/Logic/Download/KokoroTtsCppDownloadService.cs","lineNumber":114,"sourceCode":"\n    private static string GetUrl()\n    {\n        if (OperatingSystem.IsWindows())\n        {\n            return WindowsUrl;\n        }\n\n        if (OperatingSystem.IsLinux())\n        {\n            return RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? LinuxArmUrl : LinuxUrl;\n        }\n\n        if (OperatingSystem.IsMacOS())\n        {\n            return MacUrl;\n        }\n\n        throw new PlatformNotSupportedException();\n    }\n}\n","sourceCodeStart":96,"sourceCodeEnd":117,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/KokoroTtsCppDownloadService.cs#L96-L117","documentation":"Terminal fallback thrown by KokoroTtsCppDownloadService.GetUrl() when the OS is neither Windows nor Linux nor macOS. The method has URLs for Windows, Linux (Arm64 and x64), and macOS, then a bare 'throw new PlatformNotSupportedException()' for anything else (default message 'Operation is not supported on this platform.').","triggerScenarios":"Running on an OS where OperatingSystem.IsWindows/IsLinux/IsMacOS all return false — e.g. FreeBSD, a bare-metal/RTOS, or a .NET runtime that doesn't categorize the host. Normal desktop/mobile OSes never reach this.","commonSituations":"Unsupported host OS; running under an exotic runtime; future OS not yet covered. Practically unreachable on Windows/Linux/macOS, which is the intended support matrix.","solutions":["Run on Windows, Linux (x64 or ARM64), or macOS where URLs are defined.","If a new OS must be supported, add its branch returning the matching Kokoro build URL.","At the caller, gate Kokoro TTS on the supported OS set and disable gracefully elsewhere."],"exampleFix":"// before (bare throw with default message)\nthrow new PlatformNotSupportedException();\n\n// after (descriptive message, same behavior)\nthrow new PlatformNotSupportedException($\"Kokoro TTS download is not supported on {RuntimeInformation.OSDescription}.\");","handlingStrategy":"validation","validationCode":"static bool IsKokoroTtsSupportedPlatform()\n    => OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();\n\nif (!IsKokoroTtsSupportedPlatform()) { DisableKokoroTts(); return; }","typeGuard":"static bool KokoroTtsPlatformSupported()\n    => OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();","tryCatchPattern":"try { var url = kokoroService.GetUrl(); }\ncatch (PlatformNotSupportedException)\n{ _logger.Warning(\"Kokoro TTS not supported on {OS}\", RuntimeInformation.OSDescription); DisableKokoroTts(); }","preventionTips":["Limit Kokoro TTS auto-download to Windows/Linux/macOS in the UI.","Replace the bare throw with a descriptive message for easier diagnosis.","Add a startup OS probe to short-circuit unsupported platforms."],"tags":["platform","unsupported-os","kokoro","tts","download"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}