{"record":{"id":"a356faebabce0cd1","repo":"SubtitleEdit/subtitleedit","slug":"failed-to-start-crispasr-f5-tts","errorCode":null,"errorMessage":"Failed to start crispasr (f5-tts)","messagePattern":"Failed to start crispasr \\(f5-tts\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/TextToSpeech/Engines/F5TtsCrispAsr.cs","lineNumber":594,"sourceCode":"            psi.ArgumentList.Add(\"--port\");\n            psi.ArgumentList.Add(port.ToString());\n            psi.ArgumentList.Add(\"--voice-dir\");\n            psi.ArgumentList.Add(GetSetVoicesFolder());\n            CrispAsrTtsProvenance.AddServerMarkingArgs(psi.ArgumentList, exe);\n\n            if (UseStartupVoiceFlags)\n            {\n                psi.ArgumentList.Add(\"--voice\");\n                psi.ArgumentList.Add(voicePath);\n                if (!string.IsNullOrEmpty(refText))\n                {\n                    psi.ArgumentList.Add(\"--ref-text\");\n                    psi.ArgumentList.Add(refText);\n                }\n            }\n\n            var process = Process.Start(psi)\n                ?? throw new InvalidOperationException(\"Failed to start crispasr (f5-tts)\");\n\n            var launchCommand = FormatLaunchCommand(exe, psi.ArgumentList);\n            _serverLaunchCommand = launchCommand;\n            Se.WriteToolsLog(\"F5-TTS (CrispASR) server starting — \"\n                + $\"PID: {process.Id}, \"\n                + $\"Cmd: {launchCommand}\");\n\n            lock (_serverLog) _serverLog.Clear();\n            process.ErrorDataReceived += (_, e) =>\n            {\n                if (e.Data != null) lock (_serverLog) _serverLog.AppendLine(e.Data);\n            };\n            process.OutputDataReceived += (_, e) =>\n            {\n                if (e.Data != null) lock (_serverLog) _serverLog.AppendLine(e.Data);\n            };\n            process.BeginErrorReadLine();\n            process.BeginOutputReadLine();","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/F5TtsCrispAsr.cs#L576-L612","documentation":"InvalidOperationException thrown when Process.Start(psi) returns null while launching the f5-tts server. On modern .NET Process.Start throws rather than returning null, so this guard is defensive/unreachable; hitting it implies the runtime returned a null process handle.","triggerScenarios":"Process.Start(psi) with the fully-built f5-tts ProcessStartInfo evaluates to null under the null-coalescing throw. Requires a platform/runtime quirk where Start returns null instead of throwing.","commonSituations":"Essentially unreachable on .NET 6+; hypothetically a broken Process implementation or a heavily constrained host returning null handles.","solutions":["Treat as a runtime/platform anomaly — check the .NET runtime version and host.","Re-run on a supported .NET runtime where Process.Start throws with a real error.","If reproducing, capture the ProcessStartInfo state and report against the runtime."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await f5TtsEngine.Speak(text, out, voice, lang, region, model, ct); }\ncatch (InvalidOperationException ex) when (ex.Message == \"Failed to start crispasr (f5-tts)\")\n{\n    Se.WriteToolsLog(\"Runtime returned null from Process.Start; report platform/runtime anomaly.\", true);\n}","preventionTips":["Run on a supported .NET runtime where Process.Start throws informative errors.","Treat this guard as effectively unreachable — investigate the host if it fires."],"tags":["tts","f5-tts","crispasr","process-start","defensive","unreachable"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}