SubtitleEdit/subtitleedit · error · FileNotFoundException

Kokoro TTS server executable not found.

Error message

Kokoro TTS server executable not found.

What it means

FileNotFoundException from KokoroTtsCpp.EnsureServerRunningAsync when GetExecutableFileName() resolves to a path that does not exist on disk. The kokoro-tts-server binary is missing; the missing path is passed as the exception's FileName. Thrown inside the ServerLock before any process is started.

Source

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

    private static async Task EnsureServerRunningAsync(CancellationToken ct)
    {
        if (_serverProcess is { HasExited: false } && _serverPort != 0)
        {
            return;
        }

        await ServerLock.WaitAsync(ct);
        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,

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Download/install the kokoro-tts-server binary into the expected folder.
  2. Verify GetExecutableFileName() returns the real path and the file exists there.
  3. If the binary lives elsewhere, point the Kokoro engine location setting at it.
  4. Re-run the engine setup/download flow.
Defensive patterns

Strategy: validation

Validate before calling

var exe = engine.GetExecutableFileName(); // if exposed
if (!File.Exists(exe)) { PromptDownloadKokoroServer(); return; }

Try / catch

try { await kokoroEngine.Speak(...); }
catch (FileNotFoundException ex) when (ex.Message.Contains("server executable not found"))
{
    PromptDownloadKokoroServer();
}

Prevention

When it happens

Trigger: kokoro-tts-server was never installed/downloaded; the install folder was deleted or moved; the configured models folder location changed and the binary lookup now points elsewhere; portable-mode path drift.

Common situations: Fresh install where the Kokoro engine was selected before downloading the server; user cleaned up the engine folder; the binary is present but GetExecutableFileName() looks in the wrong place.

Related errors


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