{"record":{"id":"9afc7fabdb533f4c","repo":"SubtitleEdit/subtitleedit","slug":"crispasr-cosyvoice3-tts-exited-during-startup-c","errorCode":null,"errorMessage":"crispasr (cosyvoice3-tts) exited during startup (code {exitCode}). Output: {tail}{LaunchCmdSuffix}","messagePattern":"crispasr \\(cosyvoice3-tts\\) exited during startup \\(code (.+?)\\)\\. Output: (.+?)(.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/TextToSpeech/Engines/CosyVoice3CrispAsr.cs","lineNumber":790,"sourceCode":"\n            // Local startup is fast; first-run --auto-download (~921 MB minimum, ~2.5 GB for F16)\n            // needs a generous timeout for the silent companion fetch behind -m auto.\n            var deadline = DateTime.UtcNow.AddMinutes(allLocal ? 5 : 30);\n            while (DateTime.UtcNow < deadline)\n            {\n                ct.ThrowIfCancellationRequested();\n                if (process.HasExited)\n                {\n                    var tail = SnapshotServerLog();\n                    var exitCode = process.ExitCode;\n                    var exitedLaunchCommand = _serverLaunchCommand;\n                    _serverProcess = null;\n                    _serverPort = 0;\n                    _serverLaunchCommand = null;\n                    _serverModelKey = null;\n                    _serverVoiceArg = null;\n                    _serverRefText = null;\n                    throw new InvalidOperationException(\n                        $\"crispasr (cosyvoice3-tts) exited during startup (code {exitCode}). Output: {tail}\"\n                        + LaunchCmdSuffix(exitedLaunchCommand));\n                }\n                if (await ProbeHealthAsync(port, TimeSpan.FromSeconds(2), ct))\n                {\n                    return;\n                }\n                await Task.Delay(TimeSpan.FromSeconds(1), ct);\n            }\n\n            var lastOutput = SnapshotServerLog();\n            var timeoutLaunchCommand = _serverLaunchCommand;\n            StopServerInternal();\n            throw new TimeoutException(\n                $\"crispasr (cosyvoice3-tts) did not report healthy within {(allLocal ? 5 : 30)} minutes. Last output: {lastOutput}\"\n                + LaunchCmdSuffix(timeoutLaunchCommand));\n        }\n        finally","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/CosyVoice3CrispAsr.cs#L772-L808","documentation":"InvalidOperationException from CosyVoice3CrispAsr.EnsureServerRunningAsync: the crispasr (cosyvoice3-tts) process exited before the /health probe succeeded. Unlike Chatterbox's launcher, CosyVoice3 has no signature matchers here — every startup-time exit surfaces as this generic error with the exit code and the captured log tail.","triggerScenarios":"Inside the startup loop (deadline = allLocal ? 5 : 30 min), process.HasExited becomes true; the code snapshots the log, nulls all _server* fields, and throws with the exit code and tail.","commonSituations":"Missing or corrupt LLM/flow/hift/s3tok/campplus/voices files (the comment lists all required siblings); a voice path or preset the backend rejects at boot; the --ref-text was empty for a clone that requires it; a model-key/quant mismatch; insufficient RAM for F16.","solutions":["Read the 'Output:' tail — it identifies the missing file or the backend's fatal error.","Verify all required model files are present via AreModelsInstalled(modelKey); if any are missing, let --auto-download fetch them.","Confirm the voice arg (preset name or absolute WAV path) is valid and, for clones, that ref-text is provided.","On low-RAM machines, use the Q4K model key instead of F16.","Re-download the CosyVoice3 model bundle if files look corrupt."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate that all required model siblings are present before launching.\nif (!CosyVoice3CrispAsr.AreModelsInstalled(modelKey)) {\n    Se.WriteToolsLog(\"CosyVoice3 model files incomplete; allowing --auto-download.\", true);\n}","typeGuard":null,"tryCatchPattern":"try { await cosyVoice3Engine.Speak(text, out, voice, lang, region, model, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"exited during startup\", StringComparison.Ordinal))\n{\n    Se.WriteToolsLog($\"CosyVoice3 startup exit: {ex.Message}\", true);\n    // Surface the 'Output:' tail so the user fixes the named cause; do not blind-retry.\n}","preventionTips":["Verify all required model files (LLM/flow/hift/s3tok/campplus/voices) are present.","Provide a valid voice arg and, for clones, a ref-text at startup.","Use the Q4K model key on low-RAM hosts."],"tags":["tts","cosyvoice3","crispasr","process-exit","startup","diagnostics"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}