SubtitleEdit/subtitleedit · error · FileNotFoundException
llama.cpp model not found - please download a model first.
Error message
llama.cpp model not found - please download a model first.
What it means
Thrown by LlamaCppServerManager when starting llama-server: the resolved modelPath (a .gguf file) does not exist on disk. It is a FileNotFoundException whose FileName is the missing path. The check happens AFTER the executable presence check, so reaching it means llama-server itself is present but the model weight file is not.
Source
Thrown at src/libuilogic/LlamaCpp/LlamaCppServerManager.cs:506
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();
var psi = new ProcessStartInfo
{
WorkingDirectory = Path.GetDirectoryName(exe) ?? GetAndCreateFolder(),
FileName = exe,
UseShellExecute = false,View on GitHub (pinned to 17a9f07487)
Solutions
- Re-download the model from Subtitle Edit (Auto-translate > llama.cpp > Download) so the .gguf lands in GetAndCreateModelsFolder().
- Verify the resolved modelPath with File.Exists before calling StartServer and surface a user-facing message if it is missing.
- If you keep models elsewhere, pass an absolute path via --translate-model:<path.gguf> so resolution skips the models folder.
- Check for a half-written download (size far smaller than expected) and delete it so SE re-downloads.
Example fix
// before
if (!File.Exists(modelPath))
throw new FileNotFoundException("llama.cpp model not found - please download a model first.", modelPath);
// after (caller-side guard)
if (!File.Exists(modelPath))
return Result.Fail($"Model not found at '{modelPath}'. Download it via SE Auto-translate > llama.cpp, or pass --translate-model."); Defensive patterns
Strategy: validation
Validate before calling
public static void EnsureModelPresent(string modelPath)
{
if (!File.Exists(modelPath))
throw new InvalidOperationException(
$"Model '{modelPath}' is missing. Download via SE Auto-translate > llama.cpp.");
var info = new FileInfo(modelPath);
if (info.Length < 1024 * 1024)
throw new InvalidOperationException($"Model '{modelPath}' looks truncated ({info.Length} bytes).");
} Type guard
null
Try / catch
null
Prevention
- Call File.Exists on the resolved modelPath before invoking StartServer and surface a clear message.
- After a download, verify the .gguf size matches the HuggingFace expected size to catch partial files.
- Treat GetModelPath output as untrusted — log it once per run so mis-resolution is visible.
When it happens
Trigger: Calling the server start path with a LlamaCppModel whose local file was deleted, moved, or never finished downloading; GetModelPath() resolving to a path under the SE models folder that no longer contains the .gguf.
Common situations: User picked a model in the SE GUI, then cleaned the Models folder; an interrupted download left a partial file that File.Exists rejects; antivirus quarantined the .gguf; the model file lives under %AppData% on a different user account.
Related errors
- Translate model '{name}' not found in {LlamaCppServerManager
- llama-server executable not found - please download llama.cp
- llama.cpp vision projector not found - please download the m
- Translate model file not found: {name}
- No llama.cpp translate model found in {LlamaCppServerManager
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/839b0a584cee8081.
Report an issue: GitHub.