SubtitleEdit/subtitleedit · error · FileNotFoundException

Kokoro TTS model or voices file missing.

Error message

Kokoro TTS model or voices file missing.

What it means

FileNotFoundException from KokoroTtsCpp.EnsureServerRunningAsync when either the model file (TtsModelFileName) or the voices file (VoicesModelFileName) is absent in GetSetModelsFolder(). The exception's FileName is set to whichever of the two is missing (voices if the model exists, else model). The server binary is present but cannot run without its model assets.

Source

Thrown at src/ui/Features/Video/TextToSpeech/Engines/KokoroTtsCpp.cs:305

        try
        {
            if (_serverProcess is { HasExited: false } && _serverPort != 0)
            {
                return;
            }

            var exe = GetExecutableFileName();
            if (!File.Exists(exe))
            {
                throw new FileNotFoundException("Kokoro TTS server executable not found.", exe);
            }

            var modelsFolder = GetSetModelsFolder();
            var modelPath  = Path.Combine(modelsFolder, TtsModelFileName);
            var voicesPath = Path.Combine(modelsFolder, VoicesModelFileName);
            if (!File.Exists(modelPath) || !File.Exists(voicesPath))
            {
                throw new FileNotFoundException("Kokoro TTS model or voices file missing.",
                    File.Exists(modelPath) ? voicesPath : modelPath);
            }

            var port = FindFreeLoopbackPort();
            var psi = new ProcessStartInfo
            {
                // Working directory must be GetSetFolder() so the server can find dict/vocab.txt
                // (relative path baked into the binary's default --vocab arg).
                WorkingDirectory = GetSetFolder(),
                FileName = exe,
                UseShellExecute = false,
                CreateNoWindow = true,
                RedirectStandardError = true,
                RedirectStandardOutput = true,
            };
            psi.ArgumentList.Add("-m");
            psi.ArgumentList.Add(modelPath);
            psi.ArgumentList.Add("-V");

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Re-download the Kokoro model and voices files into GetSetModelsFolder().
  2. Confirm both TtsModelFileName and VoicesModelFileName exist and are non-zero bytes.
  3. Point the models folder setting at the location that actually contains both files.
  4. If only one file is missing, download just that one — the FileName field tells you which.
Defensive patterns

Strategy: validation

Validate before calling

var folder = engine.GetSetModelsFolder();
if (!File.Exists(Path.Combine(folder, TtsModelFileName)) ||
    !File.Exists(Path.Combine(folder, VoicesModelFileName)))
{
    PromptDownloadKokoroModels();
    return;
}

Try / catch

try { await kokoroEngine.Speak(...); }
catch (FileNotFoundException ex) when (ex.Message.Contains("model or voices file missing"))
{
    PromptDownloadKokoroModels(ex.FileName); // FileName tells which one
}

Prevention

When it happens

Trigger: Model/voices download was interrupted leaving one file present and one missing; the models folder was partially cleared; a version upgrade renamed the expected model file but only one was re-downloaded; the folder was moved and assets left behind.

Common situations: Partial download after a network drop; user deleted the large model file but kept the small voices file; settings point GetSetModelsFolder() at a folder that lacks the assets.

Related errors


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