SubtitleEdit/subtitleedit · error · InvalidOperationException

Translate model '{name}' not found in {LlamaCppServerManager

Error message

Translate model '{name}' not found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. Download one in Subtitle Edit (Auto-translate > llama.cpp), drop a .gguf into that folder, or pass a full path via --translate-model.

What it means

InvalidOperationException from ResolveLlamaCppModel when the user passed a bare model NAME (no path separator) and it matches neither a curated nor custom installed model in GetAndCreateModelsFolder(). The message points to that folder and gives three remediation paths: GUI download, manual .gguf drop, or --translate-model:<path>.

Source

Thrown at src/seconv/Core/AutoTranslateRunner.cs:235

                if (!File.Exists(name))
                {
                    throw new InvalidOperationException($"Translate model file not found: {name}");
                }

                var fileName = Path.GetFileName(name);
                var (chatTemplate, noJinja) = LlamaCppServerManager.InferChatTemplate(fileName);
                return new LlamaCppModel(fileName, Path.GetFullPath(name), string.Empty, Url: string.Empty,
                    ChatTemplate: chatTemplate, NoJinja: noJinja);
            }

            // Name: match curated + custom models in the models folder (with or without .gguf).
            var all = LlamaCppServerManager.GetAllTranslateModels();
            var model = all.FirstOrDefault(m => m.FileName.Equals(name, StringComparison.OrdinalIgnoreCase))
                        ?? all.FirstOrDefault(m => m.FileName.Equals(name + ".gguf", StringComparison.OrdinalIgnoreCase))
                        ?? all.FirstOrDefault(m => m.DisplayName.Equals(name, StringComparison.OrdinalIgnoreCase));
            if (model == null || !LlamaCppServerManager.IsModelInstalled(model))
            {
                throw new InvalidOperationException(
                    $"Translate model '{name}' not found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. " +
                    "Download one in Subtitle Edit (Auto-translate > llama.cpp), drop a .gguf into that folder, " +
                    "or pass a full path via --translate-model.");
            }

            return model;
        }

        // No model given: pick the first installed translate model (curated order, then custom).
        var installed = LlamaCppServerManager.GetAllTranslateModels().FirstOrDefault(LlamaCppServerManager.IsModelInstalled);
        if (installed == null)
        {
            throw new InvalidOperationException(
                $"No llama.cpp translate model found in {LlamaCppServerManager.GetAndCreateModelsFolder()}. " +
                "Download one in Subtitle Edit (Auto-translate > llama.cpp), drop a .gguf into that folder, " +
                "or pass --translate-model:<path.gguf>.");
        }

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Open SE GUI > Auto-translate > llama.cpp and click Download for the model you named.
  2. Drop the matching .gguf into the folder printed in the message (GetAndCreateModelsFolder()).
  3. Verify the exact filename (including case on Linux) — the match is against FileName/DisplayName.
  4. If you have the file elsewhere, pass its full path with --translate-model:<path.gguf> to bypass the folder lookup.

Example fix

// before
throw new InvalidOperationException(
    $"Translate model '{name}' not found in {LlamaCppServerManager.GetAndCreateModelsFolder()}.");

// after — list what IS installed so the user can copy/paste
var installed = all.Where(LlamaCppServerManager.IsModelInstalled).Select(m => m.FileName);
throw new InvalidOperationException($"Translate model '{name}' not found. Installed: {string.Join(", ", installed)}.");
Defensive patterns

Strategy: validation

Validate before calling

var all = LlamaCppServerManager.GetAllTranslateModels();
var match = all.FirstOrDefault(m => m.FileName.Equals(name, StringComparison.OrdinalIgnoreCase)) ?? all.FirstOrDefault(m => m.FileName.Equals(name + ".gguf", StringComparison.OrdinalIgnoreCase));
if (match == null || !LlamaCppServerManager.IsModelInstalled(match))
    throw new InvalidOperationException($"Model '{name}' not installed. Installed: {string.Join(", ", all.Where(LlamaCppServerManager.IsModelInstalled).Select(m => m.FileName))}.");

Type guard

static bool IsModelInstalledByName(string name) =>
    LlamaCppServerManager.GetAllTranslateModels()
        .Any(m => m.FileName.Equals(name, StringComparison.OrdinalIgnoreCase) && LlamaCppServerManager.IsModelInstalled(m));

Try / catch

null

Prevention

When it happens

Trigger: Calling --translate-model:gemma-9b when no gemma-9b.gguf (curated or custom) is present in the models folder, or IsModelInstalled returns false for the matched entry.

Common situations: User expects a curated model that was never downloaded; filename casing mismatch on case-sensitive filesystems; model file exists but IsModelInstalled considers it incomplete.

Related errors


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