{"record":{"id":"83f65b2d29c540e9","repo":"SubtitleEdit/subtitleedit","slug":"enginename-engine-requires-ocr-db-path-to-lat","errorCode":null,"errorMessage":"{engineName} engine requires --ocr-db=<path-to-Latin{requiredExtension}> (or another {requiredExtension} file). Find them in `%AppData%\\Subtitle Edit\\OCR\\` or download from the SE UI.","messagePattern":"(.+?) engine requires --ocr-db=<path-to-Latin(.+?)> \\(or another (.+?) file\\)\\. Find them in `%AppData%\\\\Subtitle Edit\\\\OCR\\\\` or download from the SE UI\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/OcrEngineFactory.cs","lineNumber":31,"sourceCode":"        return engine switch\n        {\n            \"tesseract\" or \"\" => TesseractOcrEngine.Create(options.OcrLanguage),\n            \"nocr\" => new NOcrOcrEngine(ResolveOcrDbPath(options, \"nocr\", \".nocr\")),\n            \"binaryocr\" or \"binary\" => new BinaryOcrOcrEngine(ResolveOcrDbPath(options, \"binaryocr\", \".db\")),\n            \"ollama\" => new OllamaOcrEngine(options.OllamaUrl, options.OllamaModel, options.OcrLanguage),\n            \"llamacpp\" or \"llama.cpp\" or \"llama\" => LlamaCppOcrEngine.Create(options),\n            \"paddle\" or \"paddleocr\" => PaddleOcrEngine.Create(options.OcrLanguage),\n            _ => throw new InvalidOperationException(\n                $\"OCR engine '{options.OcrEngine}' is not supported. Use one of: tesseract, nocr, binaryocr, ollama, llamacpp, paddle.\")\n        };\n    }\n\n    private static string ResolveOcrDbPath(ConversionOptions options, string engineName, string requiredExtension)\n    {\n        if (string.IsNullOrWhiteSpace(options.OcrDb))\n        {\n            var displayExt = requiredExtension.TrimStart('.');\n            throw new InvalidOperationException(\n                $\"{engineName} engine requires --ocr-db=<path-to-Latin{requiredExtension}> (or another {requiredExtension} file). \" +\n                $\"Find them in `%AppData%\\\\Subtitle Edit\\\\OCR\\\\` or download from the SE UI.\");\n        }\n        var path = options.OcrDb;\n        if (!path.EndsWith(requiredExtension, StringComparison.OrdinalIgnoreCase))\n        {\n            path += requiredExtension;\n        }\n        return path;\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":43,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/OcrEngineFactory.cs#L13-L43","documentation":"Thrown by OcrEngineFactory.ResolveOcrDbPath when the nocr or binaryocr engine is selected but `--ocr-db` is null/empty/whitespace. These two engines are template-based and have no bundled data, so a database path is mandatory — unlike tesseract (which locates tessdata) or ollama/paddle (external services).","triggerScenarios":"Calling `OcrEngineFactory.Create` with `OcrEngine` = 'nocr' or 'binaryocr'/'binary' while `options.OcrDb` is unset. The factory routes these to ResolveOcrDbPath, which throws before the engine constructor runs.","commonSituations":"Assuming nocr/binaryocr work out of the box like tesseract; migrating a script from tesseract to nocr without adding --ocr-db; the GUI installed the db but the user did not copy the path into the CLI invocation.","solutions":["Add `--ocr-db=<path-to-Latin.nocr>` for nocr or `--ocr-db=<path-to-Latin.db>` for binaryocr.","Locate the db under `%AppData%\\Subtitle Edit\\OCR\\` (Windows) or copy it from a SE install.","Switch to tesseract if you have no .nocr/.db file and just need text OCR."],"exampleFix":"// before\nseconv in.sup out.srt --ocr-engine binaryocr\n// after\nseconv in.sup out.srt --ocr-engine binaryocr --ocr-db=/opt/SE/OCR/Latin.db","handlingStrategy":"validation","validationCode":"if ((options.OcrEngine is \"nocr\" or \"binaryocr\" or \"binary\") && string.IsNullOrWhiteSpace(options.OcrDb))\n    throw new ArgumentException(\"--ocr-db is required for \" + options.OcrEngine);","typeGuard":"static bool EngineNeedsDb(string? e) =>\n    e is \"nocr\" or \"binaryocr\" or \"binary\";\nstatic bool IsDbOptionSatisfied(ConversionOptions o) =>\n    !EngineNeedsDb(o.OcrEngine) || !string.IsNullOrWhiteSpace(o.OcrDb);","tryCatchPattern":"try { var engine = OcrEngineFactory.Create(options); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"requires --ocr-db\"))\n{\n    // prompt for db path, re-run\n}","preventionTips":["Cross-validate engine choice against --ocr-db presence at arg-parse time.","Surface the dependency in --help text next to each engine.","Default to tesseract in interactive prompts when no db is available."],"tags":["ocr","cli","configuration","missing-argument"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}