SubtitleEdit/subtitleedit · error · FileNotFoundException

llama-server executable not found - please download llama.cp

Error message

llama-server executable not found - please download llama.cpp first.

What it means

Thrown by LlamaCppServerManager.EnsureServerRunningAsync when the llama-server executable does not exist on disk. GetExecutable() returns either an override path (ExecutableOverride) or <pluginsFolder>/llama-server[.exe]; File.Exists returns false. The exception is a FileNotFoundException carrying the resolved path, and the message tells the user to download llama.cpp first.

Source

Thrown at src/libuilogic/LlamaCpp/LlamaCppServerManager.cs:501

        await ServerLock.WaitAsync(cancellationToken);
        try
        {
            if (IsServerRunning && _serverModelPath == modelPath && _serverContextSize == contextSize)
            {
                Configuration.Settings.Tools.LlamaCppApiUrl = ApiUrl;
                return;
            }

            // Server not running, or running with a different model - (re)start.
            if (_serverProcess != null)
            {
                StopServerInternal();
            }

            var exe = GetExecutable();
            if (!File.Exists(exe))
            {
                throw new FileNotFoundException("llama-server executable not found - please download llama.cpp first.", exe);
            }

            if (!File.Exists(modelPath))
            {
                throw new FileNotFoundException("llama.cpp model not found - please download a model first.", modelPath);
            }

            string? mmprojPath = null;
            if (model.MmprojFileName != null)
            {
                mmprojPath = GetModelPath(model.MmprojFileName);
                if (!File.Exists(mmprojPath))
                {
                    throw new FileNotFoundException("llama.cpp vision projector not found - please download the model first.", mmprojPath);
                }
            }

            var port = FindFreeLoopbackPort();

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run the in-app llama.cpp download (which places llama-server in GetAndCreateFolder()) before using an LLM engine.
  2. If using a custom build, set ExecutableOverride to its absolute path.
  3. Verify the file exists at the path in the exception (File.Exists on it).
  4. Ensure the file is executable on Linux/macOS (chmod +x) and the right binary for the OS/architecture.

Example fix

// before
var exe = GetExecutable();
if (!File.Exists(exe))
{
    throw new FileNotFoundException("llama-server executable not found - please download llama.cpp first.", exe);
}

// after - gate on IsEngineInstalled so callers can offer a download prompt instead of throwing, and hint at the override
var exe = GetExecutable();
if (!File.Exists(exe))
{
    throw new FileNotFoundException($"llama-server executable not found at '{exe}'. Download llama.cpp via the engine settings, or set ExecutableOverride to your build. Looked in: {GetAndCreateFolder()}", exe);
}
Defensive patterns

Strategy: validation

Validate before calling

// Check engine presence before attempting to start the server
var exe = LlamaCppServerManager.GetExecutable();
if (!File.Exists(exe))
{
    // Surface a clear, actionable prompt rather than letting Translate throw FileNotFoundException
    throw new InvalidOperationException($"llama.cpp is not installed. Resolved path '{exe}' does not exist. Download it via the engine settings or set ExecutableOverride.");
}
// On Linux/macOS confirm it is executable
if (!OperatingSystem.IsWindows())
{
    var mode = new System.IO.FileInfo(exe).Attributes; // attributes alone won't show +x; check via chmod if needed
}

Type guard

public static bool IsLlamaCppInstalled() => File.Exists(LlamaCppServerManager.GetExecutable());

Try / catch

try
{
    await LlamaCppServerManager.EnsureServerRunningAsync(model, token);
}
catch (FileNotFoundException ex) when (ex.Message.Contains("llama-server executable not found"))
{
    // Prompt the user to download llama.cpp, then retry; or fall back to another engine
    throw new InvalidOperationException("llama.cpp engine is missing. Download it from the engine settings and retry.", ex);
}

Prevention

When it happens

Trigger: EnsureServerRunningAsync is called to (re)start the local llama.cpp server for LLM-based translation; IsEngineInstalled() would already be false; the code proceeds to File.Exists(exe) at LlamaCppServerManager.cs:499 and it returns false. Triggered the first time a user picks an LLM engine without having downloaded llama.cpp, or after the plugin folder was cleaned/moved.

Common situations: First use of an LLM translator without running the llama.cpp download; plugin folder reset/deleted; ExecutableOverride pointing at a path that no longer exists (e.g. a USB drive or a previous install location); platform mismatch (expecting llama-server.exe on Linux).

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/f2a8084c4551e29e. Report an issue: GitHub.