SubtitleEdit/subtitleedit · critical · TimeoutException

llama-server did not report healthy within 5 minutes. Last o

Error message

llama-server did not report healthy within 5 minutes. Last output: {lastOutput}

What it means

TimeoutException thrown when the 5-minute startup deadline elapses without llama-server's /health probe succeeding AND the process never exited. So the server is still running but unresponsive. The message embeds the last captured server output via SnapshotServerLog and the manager then calls StopServerInternal() to clean up.

Source

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

                    _serverProcess = null;
                    _serverPort = 0;
                    _serverModelPath = null;
                    throw new InvalidOperationException(
                        $"llama-server exited during startup (code {process.ExitCode}). Output: {tail}");
                }

                if (await ProbeHealthAsync(port, TimeSpan.FromSeconds(2), cancellationToken))
                {
                    Configuration.Settings.Tools.LlamaCppApiUrl = ApiUrl;
                    return;
                }

                await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken);
            }

            var lastOutput = SnapshotServerLog();
            StopServerInternal();
            throw new TimeoutException(
                $"llama-server did not report healthy within 5 minutes. Last output: {lastOutput}");
        }
        finally
        {
            ServerLock.Release();
        }
    }

    public static void StopServer()
    {
        ServerLock.Wait();
        try
        {
            StopServerInternal();
        }
        finally
        {
            ServerLock.Release();

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Use a smaller quant or a faster model so load completes well inside 5 minutes on your hardware.
  2. Keep the .gguf on local SSD so memory-map load is fast; avoid network/USB storage.
  3. If 5 minutes is genuinely too short for your hardware, raise the deadline constant in StartServer (it is currently hardcoded).
  4. Reproduce the launch manually and time how long 'model loaded' takes; if it never appears, the model is too large for available RAM and is thrashing.
  5. Confirm ProbeHealthAsync targets the same loopback port FindFreeLoopbackPort returned — a port mismatch makes the probe miss a healthy server.

Example fix

// before
var deadline = DateTime.UtcNow.AddMinutes(5);

// after — derive from model size so big models get more headroom
var loadMinutes = EstimateLoadMinutes(modelPath) switch { > 0 => Math.Max(5, EstimateLoadMinutes(modelPath)), _ => 5 };
var deadline = DateTime.UtcNow.AddMinutes(loadMinutes);
Defensive patterns

Strategy: retry

Validate before calling

var estimatedLoadMinutes = Math.Max(5, new FileInfo(modelPath).Length / (200L * 1024 * 1024)); // ~200MB/min crude floor
var deadline = DateTime.UtcNow.AddMinutes(estimatedLoadMinutes);

Type guard

null

Try / catch

try { await StartServerAsync(model, token); }
catch (TimeoutException ex) { SeLogger.Error(ex, "Health probe timed out; consider a smaller model or local SSD."); throw; }

Prevention

When it happens

Trigger: Server boots, takes longer than 5 minutes to load the model, and has not answered ProbeHealthAsync on the chosen loopback port. Common on CPU-only hosts loading large models, slow disks, or when the server binds a different port/interface than the probe expects.

Common situations: Large 70B-class model on a slow CPU; cold disk cache; model being memory-mapped off network storage; AV scanning the .gguf during load; server printing 'loading model' for many minutes.

Related errors


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