{"record":{"id":"cdf0d04c672864d7","repo":"SubtitleEdit/subtitleedit","slug":"engine-error","errorCode":null,"errorMessage":"{engine.Error}","messagePattern":"\\{engine\\.Error\\}","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/VideoOcr/VideoOcrViewModel.cs","lineNumber":1015,"sourceCode":"        {\n            throw new Exception(Se.Language.Ocr.CrispEmbedNotDownloaded);\n        }\n\n        using var engine = new CrispEmbedOcr(Se.Settings.Ocr.CrispEmbedOcrTimeoutMinutes);\n\n        var started = backend.UsesTextDetector\n            ? engine.StartCliPipeline(\n                CrispEmbedEngine.GetCliExecutable(),\n                backend.GetModelPath(model.Model),\n                backend.GetDetectorPath(model.Model))\n            : await engine.StartServerAsync(\n                CrispEmbedEngine.GetServerExecutable(),\n                backend.GetModelPath(model.Model),\n                cancellationToken);\n\n        if (!started)\n        {\n            throw new Exception(engine.Error);\n        }\n\n        await RunLlmOcr(ocrGroups, group => OcrWithBitmap(group, bitmap => engine.Ocr(bitmap, cancellationToken)),\n            () => engine.Error, reportProgress, addPreviewLine, cancellationToken);\n    }\n\n    private static async Task<string> OcrWithBitmap(VideoOcrFrameGroup group, Func<SKBitmap, Task<string>> ocr)\n    {\n        using var bitmap = SKBitmap.Decode(group.RepresentativeFileName);\n        if (bitmap == null)\n        {\n            return string.Empty;\n        }\n\n        return await ocr(bitmap);\n    }\n\n    private static async Task RunLlmOcr(","sourceCodeStart":997,"sourceCodeEnd":1033,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/VideoOcr/VideoOcrViewModel.cs#L997-L1033","documentation":"Thrown in OcrGroupsWithCrispEmbed after attempting to start the CrispEmbed engine: StartCliPipeline (for detector+recognizer backends) or StartServerAsync (for VLM backends) returned false, and engine.Error holds the reason. A false return means the server/CLI process could not be launched or did not become ready, so scanning frames is impossible and the method aborts before RunLlmOcr.","triggerScenarios":"CrispEmbed CLI executable or server executable missing/not executable; the model/detector path is wrong or the file is corrupt; the server failed to bind its port or crashed during startup; a timeout waiting for the server to become ready; missing runtime dependency (e.g. CUDA/runtime for the GGUF).","commonSituations":"Backend chosen but its executable was deleted/renamed; model download incomplete so GetModelPath points at a partial file; port already in use by a stale server process; GPU runtime missing for a GPU backend.","solutions":["Read engine.Error in the exception message for the concrete startup failure.","Confirm CrispEmbedEngine.GetCliExecutable()/GetServerExecutable() return existing, executable files.","Verify backend.GetModelPath/GetDetectorPath point at complete (non-partial) model files; re-download if needed.","Free the server port / kill stale crispembed-server processes, and ensure the required runtime (CUDA/CPU) is installed."],"exampleFix":"// before\nvar started = backend.UsesTextDetector\n    ? engine.StartCliPipeline(CrispEmbedEngine.GetCliExecutable(), backend.GetModelPath(model.Model), backend.GetDetectorPath(model.Model))\n    : await engine.StartServerAsync(CrispEmbedEngine.GetServerExecutable(), backend.GetModelPath(model.Model), cancellationToken);\nif (!started) throw new Exception(engine.Error);\n\n// after - preflight paths so the error names the missing file\nvar cli = CrispEmbedEngine.GetCliExecutable();\nvar modelPath = backend.GetModelPath(model.Model);\nif (!File.Exists(cli)) throw new Exception(\"CrispEmbed CLI not found: \" + cli);\nif (!File.Exists(modelPath)) throw new Exception(\"CrispEmbed model not found: \" + modelPath);\nvar started = backend.UsesTextDetector\n    ? engine.StartCliPipeline(cli, modelPath, backend.GetDetectorPath(model.Model))\n    : await engine.StartServerAsync(CrispEmbedEngine.GetServerExecutable(), modelPath, cancellationToken);\nif (!started) throw new Exception(engine.Error);","handlingStrategy":"validation","validationCode":"var cli = CrispEmbedEngine.GetCliExecutable();\nvar modelPath = backend.GetModelPath(model.Model);\nif (!File.Exists(cli)) throw new Exception(\"CrispEmbed CLI not found: \" + cli);\nif (!File.Exists(modelPath)) throw new Exception(\"CrispEmbed model not found: \" + modelPath);","typeGuard":null,"tryCatchPattern":"try\n{\n    var started = backend.UsesTextDetector ? engine.StartCliPipeline(...) : await engine.StartServerAsync(...);\n    if (!started) throw new Exception(engine.Error);\n}\ncatch (Exception ex) { SeLogger.Error(ex, \"CrispEmbed engine failed to start\"); /* show message */ }","preventionTips":["Preflight that the executable and model files exist and are complete.","Free the server port / kill stale crispembed-server processes before starting.","Install the runtime (CUDA/CPU) the selected backend requires."],"tags":["ocr","crispembed","video-ocr","process","ml-model"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}