{"record":{"id":"535e731fae773b27","repo":"SubtitleEdit/subtitleedit","slug":"kokoro-tts-server-executable-not-found","errorCode":null,"errorMessage":"Kokoro TTS server executable not found.","messagePattern":"Kokoro TTS server executable not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/TextToSpeech/Engines/KokoroTtsCpp.cs","lineNumber":297,"sourceCode":"    private static async Task EnsureServerRunningAsync(CancellationToken ct)\n    {\n        if (_serverProcess is { HasExited: false } && _serverPort != 0)\n        {\n            return;\n        }\n\n        await ServerLock.WaitAsync(ct);\n        try\n        {\n            if (_serverProcess is { HasExited: false } && _serverPort != 0)\n            {\n                return;\n            }\n\n            var exe = GetExecutableFileName();\n            if (!File.Exists(exe))\n            {\n                throw new FileNotFoundException(\"Kokoro TTS server executable not found.\", exe);\n            }\n\n            var modelsFolder = GetSetModelsFolder();\n            var modelPath  = Path.Combine(modelsFolder, TtsModelFileName);\n            var voicesPath = Path.Combine(modelsFolder, VoicesModelFileName);\n            if (!File.Exists(modelPath) || !File.Exists(voicesPath))\n            {\n                throw new FileNotFoundException(\"Kokoro TTS model or voices file missing.\",\n                    File.Exists(modelPath) ? voicesPath : modelPath);\n            }\n\n            var port = FindFreeLoopbackPort();\n            var psi = new ProcessStartInfo\n            {\n                // Working directory must be GetSetFolder() so the server can find dict/vocab.txt\n                // (relative path baked into the binary's default --vocab arg).\n                WorkingDirectory = GetSetFolder(),\n                FileName = exe,","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/KokoroTtsCpp.cs#L279-L315","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Download/install the kokoro-tts-server binary into the expected folder.","Verify GetExecutableFileName() returns the real path and the file exists there.","If the binary lives elsewhere, point the Kokoro engine location setting at it.","Re-run the engine setup/download flow."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var exe = engine.GetExecutableFileName(); // if exposed\nif (!File.Exists(exe)) { PromptDownloadKokoroServer(); return; }","typeGuard":null,"tryCatchPattern":"try { await kokoroEngine.Speak(...); }\ncatch (FileNotFoundException ex) when (ex.Message.Contains(\"server executable not found\"))\n{\n    PromptDownloadKokoroServer();\n}","preventionTips":["Download the kokoro-tts-server binary before enabling the engine in the UI.","Disable the Kokoro engine until the executable exists.","Verify GetExecutableFileName() after settings/folder changes.","Re-run setup if the engine folder is moved."],"tags":["kokoro","file-not-found","install","tts"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}