SubtitleEdit/subtitleedit · error · PlatformNotSupportedException
Operation is not supported on this platform.
Error message
Operation is not supported on this platform.
What it means
PlatformNotSupportedException from TesseractDownloadService.GetTesseractUrl: only Windows downloads the Tesseract binary directly. macOS and Linux are expected to install Tesseract via their package manager (brew/apt), so the URL lookup intentionally throws to route the user to the package-manager path handled in OcrViewModel.CheckAndDownloadTesseract.
Source
Thrown at src/ui/Logic/Download/TesseractDownloadService.cs:37
private const string WindowsUrl = "https://github.com/SubtitleEdit/support-files/releases/download/tesseract550/Tesseract550.zip";
private readonly IZipUnpacker _zipUnpacker;
public TesseractDownloadService(HttpClient httpClient, IZipUnpacker zipUnpacker)
{
_httpClient = httpClient;
_zipUnpacker = zipUnpacker;
}
private static string GetTesseractUrl()
{
if (OperatingSystem.IsWindows())
{
return WindowsUrl;
}
// macOS/Linux use a package-manager install ("brew install tesseract" /
// "apt install tesseract-ocr") - see OcrViewModel.CheckAndDownloadTesseract.
throw new PlatformNotSupportedException();
}
public async Task DownloadTesseract(Stream stream, IProgress<float>? progress, CancellationToken cancellationToken)
{
await DownloadHelper.DownloadFileAsync(_httpClient, GetTesseractUrl(), stream, progress, cancellationToken);
}
public async Task DownloadTesseractModel(string modelUrl, Stream stream, IProgress<float>? progress, CancellationToken cancellationToken)
{
await DownloadHelper.DownloadFileAsync(_httpClient, modelUrl, stream, progress, cancellationToken);
}
}View on GitHub (pinned to 17a9f07487)
Solutions
- On macOS run: brew install tesseract
- On Linux run: sudo apt install tesseract-ocr (or the distro equivalent).
- On Windows, ensure the call path is correct so GetTesseractUrl returns WindowsUrl.
- In caller code (OcrViewModel.CheckAndDownloadTesseract), catch PlatformNotSupportedException and guide the user to the package-manager instructions.
Example fix
// before
throw new PlatformNotSupportedException();
// after - name the path the user should take
throw new PlatformNotSupportedException(
OperatingSystem.IsMacOS()
? "Install Tesseract via 'brew install tesseract'."
: "Install Tesseract via your package manager, e.g. 'apt install tesseract-ocr'."); Defensive patterns
Strategy: validation
Validate before calling
if (!OperatingSystem.IsWindows())
{
// do NOT call DownloadTesseract; instruct the user to install via package manager
var hint = OperatingSystem.IsMacOS() ? "brew install tesseract" : "apt install tesseract-ocr";
throw new InvalidOperationException($"Install Tesseract manually: {hint}");
} Try / catch
try { await service.DownloadTesseract(stream, progress, ct); }
catch (PlatformNotSupportedException)
{
// route user to OcrViewModel.CheckAndDownloadTesseract package-manager guidance
} Prevention
- Skip DownloadTesseract entirely on Mac/Linux and show the package-manager hint.
- Verify Tesseract is installed (which tesseract) before invoking OCR features.
- Document the platform-specific install path in user help.
When it happens
Trigger: GetTesseractUrl called on a non-Windows OS. The throw is by design - the comment documents that macOS/Linux use package-manager install instead.
Common situations: Calling DownloadTesseract on Mac/Linux when the user hasn't installed Tesseract via brew/apt yet. This is the expected control-flow signal that the package-manager path must be taken, not necessarily a bug.
Related errors
- Operation is not supported on this platform.
- PaddleOCR is not available for Linux ARM64.
- Operation is not supported on this platform.
- Operation is not supported on this platform.
- Process.Start() is not supported on this platform.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/bafcefa825a7f2aa.
Report an issue: GitHub.