{"record":{"id":"992f38c48a420d73","repo":"SubtitleEdit/subtitleedit","slug":"failed-to-start-crispasr-chatterbox","errorCode":null,"errorMessage":"Failed to start crispasr (chatterbox)","messagePattern":"Failed to start crispasr \\(chatterbox\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/TextToSpeech/Engines/ChatterboxTtsCpp.cs","lineNumber":593,"sourceCode":"            // and synth returns empty audio.\n            psi.ArgumentList.Add(\"--codec-model\");\n            psi.ArgumentList.Add(GetS3GenModelPath(modelKey));\n            psi.ArgumentList.Add(\"--host\");\n            psi.ArgumentList.Add(\"127.0.0.1\");\n            psi.ArgumentList.Add(\"--port\");\n            psi.ArgumentList.Add(port.ToString());\n            // The crispasr server gates /v1/audio/speech requests with a `voice` field\n            // behind --voice-dir being set (\"warning: --voice-dir not set; … will reject\n            // requests with a 'voice' field\"). Pointing --voice-dir at our voices folder\n            // satisfies the gate and also makes /v1/voices reflect the imported WAVs. It\n            // does not make the chatterbox backend look the voice up in there though -\n            // that is what the working directory above is for.\n            psi.ArgumentList.Add(\"--voice-dir\");\n            psi.ArgumentList.Add(GetSetVoicesFolder());\n            CrispAsrTtsProvenance.AddServerMarkingArgs(psi.ArgumentList, exe);\n\n            var process = Process.Start(psi)\n                ?? throw new InvalidOperationException(\"Failed to start crispasr (chatterbox)\");\n\n            // Record the exact launch command in the tools log so failures later in this\n            // session can be reproduced from a shell. Also cache it on the static so the\n            // runtime/startup error paths can surface it inline with the error dialog.\n            var launchCommand = FormatLaunchCommand(exe, psi.ArgumentList);\n            _serverLaunchCommand = launchCommand;\n            Se.WriteToolsLog(\"Chatterbox TTS 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);","sourceCodeStart":575,"sourceCodeEnd":611,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/ChatterboxTtsCpp.cs#L575-L611","documentation":"Process.Start(psi) returned null, which on modern .NET essentially never happens for a real executable — it indicates the runtime/platform could not spawn a process at all. The engine throws InvalidOperationException naming the failure.","triggerScenarios":"Process.Start returns null rather than throwing — historically only on platforms/runtimes without a process-launch capability or in heavily sandboxed hosts.","commonSituations":"Running under a sandbox/container that blocks process creation; very old or non-standard runtime; execute permission missing on the binary on POSIX.","solutions":["Run outside any sandbox that blocks process spawning.","Verify the exe path exists and (on POSIX) has the execute bit set.","Check the runtime supports Process.Start on this platform.","Capture and log psi.FileName / Arguments to reproduce manually."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!File.Exists(exe)) return Invalid(\"exe missing: \" + exe);\n// nothing else to validate; Process.Start returning null is a host limitation","typeGuard":null,"tryCatchPattern":"try { EnsureServerRunningAsync(modelKey, ct).Wait(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"Failed to start crispasr\"))\n{ /* host cannot spawn processes; run outside the sandbox */ }","preventionTips":["Run the host in an environment that permits process spawning.","Verify execute permission on the binary on POSIX.","Log psi.FileName + Arguments so the spawn can be reproduced manually."],"tags":["chatterbox","crispasr","process-start","text-to-speech"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}