{"record":{"id":"6d0e1dae44d830a2","repo":"SubtitleEdit/subtitleedit","slug":"llama-server-not-found-either-download-llama-cpp","errorCode":null,"errorMessage":"llama-server not found. Either: download llama.cpp in Subtitle Edit ({guiDownloadHint}), install it on PATH (e.g. `brew install llama.cpp` or `winget install ggml.llamacpp`), or point {urlOption} at an already-running llama-server.","messagePattern":"llama-server not found\\. Either: download llama\\.cpp in Subtitle Edit \\((.+?)\\), install it on PATH \\(e\\.g\\. `brew install llama\\.cpp` or `winget install ggml\\.llamacpp`\\), or point (.+?) at an already-running llama-server\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/LlamaCppLocal.cs","lineNumber":23,"sourceCode":"/// <summary>\n/// Locates a local llama-server binary for the llama.cpp translate/OCR engines without\n/// downloading anything: the Subtitle Edit data folders are probed first (so an install done\n/// via the SE GUI is picked up automatically), then the system PATH.\n/// </summary>\ninternal static class LlamaCppLocal\n{\n    /// <summary>\n    /// Resolves llama-server and points <see cref=\"LlamaCppServerManager\"/> at it (folder or\n    /// executable override). Throws with download instructions when nothing is found;\n    /// <paramref name=\"guiDownloadHint\"/> names the SE window that installs llama.cpp\n    /// (e.g. \"Auto-translate &gt; llama.cpp\") and <paramref name=\"urlOption\"/> the CLI option\n    /// that skips the local auto-start (e.g. \"--translate-url\").\n    /// </summary>\n    public static void EnsureServerBinary(string guiDownloadHint, string urlOption)\n    {\n        if (!TryEnsureServerBinary())\n        {\n            throw new InvalidOperationException(\n                $\"llama-server not found. Either: download llama.cpp in Subtitle Edit ({guiDownloadHint}), \" +\n                \"install it on PATH (e.g. `brew install llama.cpp` or `winget install ggml.llamacpp`), \" +\n                $\"or point {urlOption} at an already-running llama-server.\");\n        }\n    }\n\n    /// <summary>Same as <see cref=\"EnsureServerBinary\"/> but returns false instead of throwing.</summary>\n    public static bool TryEnsureServerBinary()\n    {\n        // Folder candidates in priority order: portable SE (seconv sits next to SubtitleEdit,\n        // data folder = exe folder), then the installed GUI's data folder.\n        var candidates = new[]\n        {\n            Path.Combine(AppContext.BaseDirectory, \"llama.cpp\"),\n            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), \"Subtitle Edit\", \"llama.cpp\"),\n        };\n\n        var exeName = OperatingSystem.IsWindows() ? \"llama-server.exe\" : \"llama-server\";","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/LlamaCppLocal.cs#L5-L41","documentation":"Thrown by LlamaCppLocal.EnsureServerBinary when TryEnsureServerBinary returns false — meaning the llama-server executable was not found in any candidate location (portable SE folder next to seconv, the installed SE GUI data folder) nor on the system PATH. This blocks local LLM-based translation and OCR features that require a running llama-server. The message includes install instructions and the CLI option name to point at an external server.","triggerScenarios":"Calling EnsureServerBinary when llama.cpp/llama-server has never been installed. The search checks: the portable SE data folder (seconv's exe directory), the SE GUI install data folder, and the system PATH. If none contains the binary, TryEnsureServerBinary returns false and this throws.","commonSituations":"First-time use of --translate or OCR features without having downloaded llama.cpp; a fresh machine or CI environment with no llama.cpp installed; llama.cpp was installed but the binary is not on PATH and not in the SE data folder; the binary name differs from the expected pattern.","solutions":["Install llama.cpp: `brew install llama.cpp` (macOS), `winget install ggml.llamacpp` (Windows), or build from source (Linux).","Download llama.cpp from within the Subtitle Edit GUI (the window named by guiDownloadHint, e.g. 'Auto-translate > llama.cpp').","Point seconv at an already-running server via the URL option (e.g. --translate-url=http://localhost:8080) to skip local binary resolution entirely.","If already installed, verify the binary is on PATH (`which llama-server`) or placed in the SE data folder."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!LlamaCppLocal.TryEnsureServerBinary())\n{\n    Console.Error.WriteLine(\"llama-server not found. Install llama.cpp or pass --translate-url.\");\n    return;\n}","typeGuard":"static bool HasLlamaServer() => LlamaCppLocal.TryEnsureServerBinary();","tryCatchPattern":"try { LlamaCppLocal.EnsureServerBinary(\"Auto-translate > llama.cpp\", \"--translate-url\"); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"llama-server not found\"))\n{ /* install llama.cpp or point at an external server URL */ }","preventionTips":["Call TryEnsureServerBinary (the non-throwing variant) to check availability before committing to an LLM pipeline.","For headless/CI environments, pre-install llama.cpp on PATH or use --translate-url to point at an external server.","Document the llama.cpp dependency and install steps in your project setup."],"tags":["llama-cpp","binary-not-found","environment","ocr","translation","dependencies"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}