SubtitleEdit/subtitleedit · error · InvalidOperationException

Qwen3 TTS (CrispASR) — the crispasr server crashed during sy

Error message

Qwen3 TTS (CrispASR) — the crispasr server crashed during synthesis. | Qwen3 TTS (CrispASR) request failed — the connection to the crispasr server was dropped.{Environment.NewLine}Server log:{Environment.NewLine}{serverLog}{LaunchCmdSuffix}

What it means

InvalidOperationException thrown when HttpClient.PostAsync to /v1/audio/speech raises an HttpRequestException. The message branches on whether _serverProcess.HasExited: if the server died it says 'crashed during synthesis', otherwise 'connection was dropped'. The captured server log and the launch command are appended, and the original HttpRequestException is chained as InnerException.

Source

Thrown at src/ui/Features/Video/TextToSpeech/Engines/Qwen3TtsCrispAsr.cs:846

            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 = $"Qwen3 TTS (CrispASR) request failed — Voice: {qwen3Voice}, Text: {text}, "
                + $"RequestJson: {body}, ServerExited: {died}, ServerLog: {serverLog}"
                + LaunchCmdSuffix(launchCommand);
            Se.LogError(ex, failMsg);
            Se.WriteToolsLog(failMsg);

            throw new InvalidOperationException(
                (died
                    ? "Qwen3 TTS (CrispASR) — the crispasr server crashed during synthesis."
                    : "Qwen3 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 = $"Qwen3 TTS (CrispASR) server error {(int)response.StatusCode} {response.StatusCode} — "
                    + $"Voice: {qwen3Voice}, Text: {text}, RequestJson: {body}, "
                    + $"ResponseBody: {errorBody}, ServerLog: {serverLog}"

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Use the crashed-vs-dropped branch in the message to narrow cause: 'crashed' means inspect the server log for the abort reason; 'dropped' means network/socket.
  2. Shorten the input text or switch to a smaller quant to reduce peak memory.
  3. Ensure no other code path stops/restarts the crispasr server while a synthesis is in flight.
  4. Re-import the reference voice if the server log complains it can't read the WAV.
Defensive patterns

Strategy: try-catch

Validate before calling

if (_serverProcess is not { HasExited: false })
    throw new InvalidOperationException("crispasr server is not running.");

Try / catch

try { response = await HttpClient.PostAsync($"{ServerBaseUrl}/v1/audio/speech", content, ct); }
catch (HttpRequestException ex)
{
    var died = _serverProcess?.HasExited == true;
    throw new InvalidOperationException(died ? "crispasr crashed during synthesis" : "connection dropped", ex);
}

Prevention

When it happens

Trigger: Server OOM/abort mid-synthesis (HasExited=true); loopback socket reset; the server is overloaded and drops the keep-alive; the request payload referenced a voice whose file was deleted out from under the server.

Common situations: Long text causes the server to exceed GPU memory and abort; another Speak on a different thread raced the server restart; antivirus terminates the server child process; the reference voice file was removed after server start.

Related errors


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