{"record":{"id":"ee74a5f54ef2efe6","repo":"SubtitleEdit/subtitleedit","slug":"no-llama-cpp-ocr-model-found-in-llamacppserverman","errorCode":null,"errorMessage":"No llama.cpp OCR model found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. Download one in Subtitle Edit (OCR window > llama.cpp) or pass --ocr-model:<path.gguf>. Curated models: {curatedNames}.","messagePattern":"No llama\\.cpp OCR model found in (.+?)\\. Download one in Subtitle Edit \\(OCR window > llama\\.cpp\\) or pass --ocr-model:<path\\.gguf>\\. Curated models: (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/LlamaCppOcrEngine.cs","lineNumber":184,"sourceCode":"            var model = LlamaCppServerManager.OcrModels.FirstOrDefault(m => m.FileName.Equals(name, StringComparison.OrdinalIgnoreCase))\n                        ?? LlamaCppServerManager.OcrModels.FirstOrDefault(m => m.FileName.Equals(name + \".gguf\", StringComparison.OrdinalIgnoreCase))\n                        ?? LlamaCppServerManager.OcrModels.FirstOrDefault(m => m.DisplayName.Equals(name, StringComparison.OrdinalIgnoreCase));\n            if (model == null || !LlamaCppServerManager.IsModelInstalled(model))\n            {\n                throw new InvalidOperationException(\n                    $\"OCR model '{name}' not found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. \" +\n                    \"Download one in Subtitle Edit (OCR window > llama.cpp) or pass a full path via --ocr-model. \" +\n                    $\"Curated models: {curatedNames}.\");\n            }\n\n            return model;\n        }\n\n        // No model given: pick the first installed curated OCR model.\n        var installed = LlamaCppServerManager.OcrModels.FirstOrDefault(LlamaCppServerManager.IsModelInstalled);\n        if (installed == null)\n        {\n            throw new InvalidOperationException(\n                $\"No llama.cpp OCR model found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. \" +\n                \"Download one in Subtitle Edit (OCR window > llama.cpp) or pass --ocr-model:<path.gguf>. \" +\n                $\"Curated models: {curatedNames}.\");\n        }\n\n        return installed;\n    }\n\n    private static string? FindMmprojSidecar(string modelPath)\n    {\n        // Both curated sidecar conventions: \"mmproj-<file>\" (GLM-OCR, LightOnOCR) and\n        // \"<stem>-mmproj.gguf\" (PaddleOCR-VL).\n        var dir = Path.GetDirectoryName(modelPath)!;\n        var candidates = new[]\n        {\n            Path.Combine(dir, \"mmproj-\" + Path.GetFileName(modelPath)),\n            Path.Combine(dir, Path.GetFileNameWithoutExtension(modelPath) + \"-mmproj.gguf\"),\n        };","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/LlamaCppOcrEngine.cs#L166-L202","documentation":"Thrown when no --ocr-model argument was given and none of the curated OCR models are installed (IsModelInstalled returns false for every entry in LlamaCppServerManager.OcrModels). The engine tries to auto-select the first installed curated model as a default; if nothing is installed, OCR cannot proceed. The message lists the models folder path and curated model names for download guidance.","triggerScenarios":"Running OCR (or a translate/OCR pipeline) without --ocr-model on a system where no curated OCR model .gguf has been downloaded into the models folder.","commonSituations":"First-time OCR use with no model downloaded; models were cleared/removed; the models folder points to a location that was wiped.","solutions":["Download a curated OCR model via the Subtitle Edit GUI (OCR window > llama.cpp).","Manually download a .gguf OCR model (and its mmproj sidecar) into the models folder shown in the message, then re-run without --ocr-model to auto-select it.","Pass --ocr-model=<full-path.gguf> to use any model outside the curated set."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!LlamaCppServerManager.OcrModels.Any(LlamaCppServerManager.IsModelInstalled))\n{\n    Console.Error.WriteLine(\"No OCR model installed. Download one via SE GUI or pass --ocr-model:<path>.\");\n    return;\n}","typeGuard":"static bool HasAnyOcrModelInstalled() => LlamaCppServerManager.OcrModels.Any(LlamaCppServerManager.IsModelInstalled);","tryCatchPattern":"try { var model = LlamaCppOcrEngine.ResolveModel(null); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"No llama.cpp OCR model found\"))\n{ /* download a curated model or pass --ocr-model:<path> */ }","preventionTips":["Check for an installed model before launching OCR pipelines.","Pre-download at least one curated OCR model as part of environment setup.","Provide --ocr-model=<full-path.gguf> in automated pipelines where model presence is guaranteed."],"tags":["llama-cpp","model-not-installed","ocr","missing-dependency","model"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}