{"record":{"id":"636f424fd1dc5c33","repo":"SubtitleEdit/subtitleedit","slug":"crispasr-qwen3-tts-exited-during-startup-code","errorCode":null,"errorMessage":"crispasr (qwen3-tts) exited during startup (code {exitCode}). Output: {tail}{LaunchCmdSuffix}","messagePattern":"crispasr \\(qwen3-tts\\) exited during startup \\(code (.+?)\\)\\. Output: (.+?)(.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"src/ui/Features/Video/TextToSpeech/Engines/Qwen3TtsCrispAsr.cs","lineNumber":1025,"sourceCode":"            _serverPort = port;\n            _serverModelKey = modelKey;\n            HookProcessExitOnce();\n\n            // First-run auto-download (~2 GB talker + ~986 MB codec) needs a generous timeout.\n            var deadline = DateTime.UtcNow.AddMinutes(hasLocalTalker && hasLocalCodec ? 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                    _serverModelKey = null;\n                    _serverLaunchCommand = null;\n                    throw new InvalidOperationException(\n                        $\"crispasr (qwen3-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 (qwen3-tts) did not report healthy within {(hasLocalTalker && hasLocalCodec ? 5 : 30)} minutes. Last output: {lastOutput}\"\n                + LaunchCmdSuffix(timeoutLaunchCommand));\n        }\n        finally","sourceCodeStart":1007,"sourceCodeEnd":1043,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/Qwen3TtsCrispAsr.cs#L1007-L1043","documentation":"InvalidOperationException thrown during the crispasr startup health-wait when process.HasExited becomes true before /health succeeds. The message includes the raw exit code, the captured server log tail, and the launch command suffix so the user can reproduce the failing invocation manually.","triggerScenarios":"Missing shared libraries abort crispasr before main; the talker/codec GGUF specified via -m is missing or corrupt; the --backend name doesn't match a compiled backend; --voice-dir points at a non-existent folder and crispasr aborts; GPU/driver incompatibility.","commonSituations":"First run before models are staged locally (the code falls back to --auto-download, which can still fail offline); a backend was compiled out of this crispasr build; a partial model download; driver/runtime mismatch.","solutions":["Read the appended Output tail — crispasr prints its fatal reason (e.g. 'failed to load talker', 'unknown backend').","Run the printed Launch command manually in a terminal to see the full stderr.","Confirm the talker and codec GGUFs are complete downloads or let --auto-download re-fetch.","Match the --backend value to a backend that exists in this crispasr build."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: confirm model files and voice dir exist.\nif (!Directory.Exists(GetSetVoicesFolder()))\n    throw new DirectoryNotFoundException(\"--voice-dir target missing.\");\nif (hasLocalTalker && !IsValidLocalModelFile(talker, GetTalkerFileName(modelKey)))\n    throw new FileNotFoundException(\"Talker model invalid\", talker);","typeGuard":null,"tryCatchPattern":"try { await EnsureServerRunningAsync(modelKey, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"exited during startup\"))\n{ await ShowServerStartupHelpAsync(ex.Message); throw; }","preventionTips":["Pre-stage complete talker/codec GGUFs or confirm network access for --auto-download.","Match --backend to a backend compiled into this crispasr build.","Run the printed launch command manually to capture full stderr."],"tags":["tts","crispasr","server-process","startup","csharp"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}