SubtitleEdit/subtitleedit · error · InvalidOperationException

Translate model file not found: {name}

Error message

Translate model file not found: {name}

What it means

InvalidOperationException from ResolveLlamaCppModel when the user passed an absolute or rooted path to a .gguf via --translate-model but that file does not exist. This branch only fires for path-shaped input (IsPathRooted or contains a separator); bare names go to the curated-models lookup.

Source

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

    private static LlamaCppModel ResolveLocalLlamaCpp(string? requestedModel)
    {
        LlamaCppLocal.EnsureServerBinary("Auto-translate > llama.cpp", "--translate-url");
        return ResolveLlamaCppModel(requestedModel);
    }

    private static LlamaCppModel ResolveLlamaCppModel(string? requestedModel)
    {
        if (!string.IsNullOrWhiteSpace(requestedModel))
        {
            var name = requestedModel.Trim();

            // Full path to a .gguf: use it directly, but infer the chat-template flags from the file
            // name (TranslateGemma/Qwen need them, whether or not we curate that exact quant).
            if (Path.IsPathRooted(name) || name.Contains(Path.DirectorySeparatorChar) || name.Contains(Path.AltDirectorySeparatorChar))
            {
                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, " +

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Verify the path with File.Exists in your shell before invoking the runner.
  2. Use an absolute path; if relative, confirm the runner's current working directory.
  3. If you just want a name match, drop the path separator and pass the bare model name instead.

Example fix

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

// after
if (!File.Exists(name))
    throw new InvalidOperationException($"Translate model file not found: '{name}'. Resolved full path: '{Path.GetFullPath(name)}'.");
Defensive patterns

Strategy: validation

Validate before calling

if (Path.IsPathRooted(name) && !File.Exists(name))
    throw new InvalidOperationException($"Translate model not found: '{name}' (resolved: '{Path.GetFullPath(name)}').");

Type guard

static bool IsExistingModelPath(string name) => Path.IsPathRooted(name) && File.Exists(name);

Try / catch

null

Prevention

When it happens

Trigger: Calling the runner with --translate-model:/foo/bar.gguf where /foo/bar.gguf does not exist on disk.

Common situations: Typo in the path; relative-looking path that resolved wrong; model moved/deleted after the command was constructed; wrong working directory.

Related errors


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