{"record":{"id":"9bdd8bec29e4fda6","repo":"SubtitleEdit/subtitleedit","slug":"f5-tts-crispasr-request-failed-the-connection","errorCode":null,"errorMessage":"F5-TTS (CrispASR) request failed — the connection to the crispasr server was dropped.","messagePattern":"F5-TTS \\(CrispASR\\) request failed — the connection to the crispasr server was dropped\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/ui/Features/Video/TextToSpeech/Engines/F5TtsCrispAsr.cs","lineNumber":424,"sourceCode":"            response = await HttpClient.PostAsync($\"{ServerBaseUrl}/v1/audio/speech\", content, cancellationToken);\n        }\n        catch (HttpRequestException ex)\n        {\n            var serverLog = SnapshotServerLog();\n            var launchCommand = _serverLaunchCommand;\n            var died = _serverProcess?.HasExited == true;\n            if (died)\n            {\n                StopServerInternal();\n            }\n\n            var failMsg = $\"F5-TTS (CrispASR) request failed — Voice: {f5Voice}, Text: {text}, \"\n                + $\"RequestJson: {body}, ServerExited: {died}, ServerLog: {serverLog}\"\n                + LaunchCmdSuffix(launchCommand);\n            Se.LogError(ex, failMsg);\n            Se.WriteToolsLog(failMsg);\n\n            throw new InvalidOperationException(\n                (died\n                    ? \"F5-TTS (CrispASR) — the crispasr server crashed during synthesis.\"\n                    : \"F5-TTS (CrispASR) request failed — the connection to the crispasr server was dropped.\")\n                + (string.IsNullOrEmpty(serverLog) ? string.Empty : $\"{Environment.NewLine}Server log:{Environment.NewLine}{serverLog}\")\n                + LaunchCmdSuffix(launchCommand),\n                ex);\n        }\n\n        using (response)\n        {\n            if (!response.IsSuccessStatusCode)\n            {\n                var errorBody = await SafeReadErrorAsync(response, cancellationToken);\n                var serverLog = SnapshotServerLog();\n                var launchCommand = _serverLaunchCommand;\n                var errMsg = $\"F5-TTS (CrispASR) server error {(int)response.StatusCode} {response.StatusCode} — \"\n                    + $\"Voice: {f5Voice}, Text: {text}, RequestJson: {body}, \"\n                    + $\"ResponseBody: {errorBody}, ServerLog: {serverLog}\"","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Features/Video/TextToSpeech/Engines/F5TtsCrispAsr.cs#L406-L442","documentation":"InvalidOperationException from F5TtsCrispAsr.Speak's HttpRequestException catch: the POST failed but the server process is still alive (_serverProcess?.HasExited != true), i.e. a dropped/reset connection rather than a dead process. The original exception is chained and the server log is appended.","triggerScenarios":"HttpClient.PostAsync raises HttpRequestException while the server process is still running — TCP reset, keep-alive timeout, server closing the socket mid-response, or a transient loopback issue.","commonSituations":"Long synthesis where the server closed an idle connection; loopback/network blip; transient OS resource exhaustion; the server briefly stopped accepting under load.","solutions":["Retry the synthesis — EnsureServerRunningAsync reuses the healthy server (or restarts it).","Shorten input text to reduce request duration and avoid keep-alive drops.","Check 'Server log' for transient backend errors that did not kill the process.","If it recurs, force a server restart via F5TtsCrispAsr.StopServer() or by changing the voice/model key."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for (int attempt = 1; attempt <= 2; attempt++)\ntry { await f5TtsEngine.Speak(text, out, voice, lang, region, model, ct); return; }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"connection to the crispasr server was dropped\", StringComparison.Ordinal) && attempt < 2)\n{ Se.WriteToolsLog($\"Transient F5-TTS connection drop, retry {attempt}.\", true); }","preventionTips":["Keep synthesis inputs short to avoid keep-alive/connection drops.","On repeated drops, force a server restart to reset connection state.","Treat a dropped connection (server alive) as transient and retry first."],"tags":["tts","f5-tts","crispasr","connection-drop","transient","http-request-exception"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}