{"record":{"id":"0040d8eb151c3890","repo":"SubtitleEdit/subtitleedit","slug":"tesseract-not-found-on-path-install-it-from-https","errorCode":null,"errorMessage":"Tesseract not found on PATH. Install it from https://tesseract-ocr.github.io/ (or `apt install tesseract-ocr` / `brew install tesseract`) and ensure the binary is on PATH.","messagePattern":"Tesseract not found on PATH\\. Install it from https://tesseract-ocr\\.github\\.io/ \\(or `apt install tesseract-ocr` / `brew install tesseract`\\) and ensure the binary is on PATH\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/TesseractOcrEngine.cs","lineNumber":48,"sourceCode":"    {\n        var name = OperatingSystem.IsWindows() ? \"tesseract.exe\" : \"tesseract\";\n        var pathEnv = Environment.GetEnvironmentVariable(\"PATH\") ?? string.Empty;\n        var separator = OperatingSystem.IsWindows() ? ';' : ':';\n        foreach (var dir in pathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries))\n        {\n            var candidate = Path.Combine(dir.Trim(), name);\n            if (File.Exists(candidate))\n            {\n                return candidate;\n            }\n        }\n        return null;\n    }\n\n    public static TesseractOcrEngine Create(string language = \"eng\")\n    {\n        var path = Detect()\n            ?? throw new InvalidOperationException(\n                \"Tesseract not found on PATH. Install it from https://tesseract-ocr.github.io/ \" +\n                \"(or `apt install tesseract-ocr` / `brew install tesseract`) and ensure the binary is on PATH.\");\n\n        var workDir = Path.Combine(Path.GetTempPath(), \"seconv_ocr_\" + Guid.NewGuid().ToString(\"N\"));\n        Directory.CreateDirectory(workDir);\n        return new TesseractOcrEngine(path, language, workDir);\n    }\n\n    /// <summary>\n    /// Runs Tesseract on a single bitmap and returns the recognised text. The bitmap is\n    /// composited onto white (Tesseract handles antialiased text better with an opaque\n    /// background) and scaled up 2× for accuracy on small subtitle bitmaps.\n    /// </summary>\n    public string Recognize(SKBitmap bitmap)\n    {\n        if (bitmap is null || bitmap.Width == 0 || bitmap.Height == 0)\n        {\n            return string.Empty;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/TesseractOcrEngine.cs#L30-L66","documentation":"Thrown by TesseractOcrEngine.Create when Detect() walks the PATH environment variable and finds no 'tesseract' (or 'tesseract.exe' on Windows) binary. seconv does not bundle Tesseract; OCR via the tesseract engine requires it installed separately and visible on PATH.","triggerScenarios":"TesseractOcrEngine.Create(language) is called (because --ocr-engine tesseract was selected for an image-to-text conversion) and Detect() returns null.","commonSituations":"Fresh CI/container without Tesseract installed; PATH not propagated to the process; Tesseract installed but only as a Windows Start-menu shortcut, not on PATH; mis-spelling the engine name so the default fell back to tesseract.","solutions":["Install Tesseract: apt install tesseract-ocr (Debian/Ubuntu), brew install tesseract (macOS), or the UB Mannheim Windows installer.","Ensure the binary directory is on PATH for the shell/CI that launches seconv (export PATH=...).","Verify with `tesseract --version` in the same environment before retrying.","Pick a different OCR engine if Tesseract is unavailable (--ocr-engine nocr / ollama / paddle)."],"exampleFix":"// before\n$ seconv movie.sup srt --ocr-engine tesseract  // not installed\n// after\n$ sudo apt install tesseract-ocr && seconv movie.sup srt --ocr-engine tesseract","handlingStrategy":"validation","validationCode":"if (TesseractOcrEngine.Detect() is null)\n    throw new InvalidOperationException(\"Install Tesseract and put it on PATH before OCR.\");","typeGuard":"static bool TesseractAvailable => TesseractOcrEngine.Detect() is not null;","tryCatchPattern":"null","preventionTips":["Pin Tesseract installation in CI/Dockerfiles.","Run `tesseract --version` as a setup smoke test.","Default to a different engine when Tesseract is optional."],"tags":["seconv","ocr","tesseract","environment","path","missing-dependency"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}