SubtitleEdit/subtitleedit · error · InvalidOperationException

F5-TTS (CrispASR) request failed — the connection to the cri

Error message

F5-TTS (CrispASR) request failed — the connection to the crispasr server was dropped.

What it means

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.

Source

Thrown at src/ui/Features/Video/TextToSpeech/Engines/F5TtsCrispAsr.cs:424

            response = await HttpClient.PostAsync($"{ServerBaseUrl}/v1/audio/speech", content, cancellationToken);
        }
        catch (HttpRequestException ex)
        {
            var serverLog = SnapshotServerLog();
            var launchCommand = _serverLaunchCommand;
            var died = _serverProcess?.HasExited == true;
            if (died)
            {
                StopServerInternal();
            }

            var failMsg = $"F5-TTS (CrispASR) request failed — Voice: {f5Voice}, Text: {text}, "
                + $"RequestJson: {body}, ServerExited: {died}, ServerLog: {serverLog}"
                + LaunchCmdSuffix(launchCommand);
            Se.LogError(ex, failMsg);
            Se.WriteToolsLog(failMsg);

            throw new InvalidOperationException(
                (died
                    ? "F5-TTS (CrispASR) — the crispasr server crashed during synthesis."
                    : "F5-TTS (CrispASR) request failed — the connection to the crispasr server was dropped.")
                + (string.IsNullOrEmpty(serverLog) ? string.Empty : $"{Environment.NewLine}Server log:{Environment.NewLine}{serverLog}")
                + LaunchCmdSuffix(launchCommand),
                ex);
        }

        using (response)
        {
            if (!response.IsSuccessStatusCode)
            {
                var errorBody = await SafeReadErrorAsync(response, cancellationToken);
                var serverLog = SnapshotServerLog();
                var launchCommand = _serverLaunchCommand;
                var errMsg = $"F5-TTS (CrispASR) server error {(int)response.StatusCode} {response.StatusCode} — "
                    + $"Voice: {f5Voice}, Text: {text}, RequestJson: {body}, "
                    + $"ResponseBody: {errorBody}, ServerLog: {serverLog}"

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Retry the synthesis — EnsureServerRunningAsync reuses the healthy server (or restarts it).
  2. Shorten input text to reduce request duration and avoid keep-alive drops.
  3. Check 'Server log' for transient backend errors that did not kill the process.
  4. If it recurs, force a server restart via F5TtsCrispAsr.StopServer() or by changing the voice/model key.
Defensive patterns

Strategy: retry

Try / catch

for (int attempt = 1; attempt <= 2; attempt++)
try { await f5TtsEngine.Speak(text, out, voice, lang, region, model, ct); return; }
catch (InvalidOperationException ex) when (ex.Message.Contains("connection to the crispasr server was dropped", StringComparison.Ordinal) && attempt < 2)
{ Se.WriteToolsLog($"Transient F5-TTS connection drop, retry {attempt}.", true); }

Prevention

When it happens

Trigger: 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.

Common situations: Long synthesis where the server closed an idle connection; loopback/network blip; transient OS resource exhaustion; the server briefly stopped accepting under load.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/9bdd8bec29e4fda6. Report an issue: GitHub.