SubtitleEdit/subtitleedit · error · InvalidOperationException

CosyVoice3 (CrispASR) — the crispasr server crashed during s

Error message

CosyVoice3 (CrispASR) — the crispasr server crashed during synthesis.

What it means

InvalidOperationException from CosyVoice3CrispAsr.Speak's HttpRequestException catch: the POST to /v1/audio/speech failed AND _serverProcess.HasExited is true, so the request failure is interpreted as the crispasr server having crashed mid-synthesis. The original HttpRequestException is chained as InnerException and the server log is appended.

Source

Thrown at src/ui/Features/Video/TextToSpeech/Engines/CosyVoice3CrispAsr.cs:588

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

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

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Inspect the appended 'Server log' for the crash cause (usually a backend assert or OOM).
  2. Retry with a different voice/preset or a shorter input text to rule out input-triggered crashes.
  3. Re-download the CosyVoice3 model bundle in case of file corruption.
  4. If on limited RAM, switch to the Q4K model key to lower memory pressure.
  5. Track the upstream CrispASR fix for the asserted backend and re-download when released.
Defensive patterns

Strategy: retry

Validate before calling

// Before synthesis, confirm the server is alive (cheap relative to a failed synth).
if (cosyVoice3Engine is CosyVoice3CrispAsr cv3 && !cv3.IsServerAlive()) {
    cv3.StopServer(); // force a clean relaunch on next Speak
}

Try / catch

try { await cosyVoice3Engine.Speak(text, out, voice, lang, region, model, ct); }
catch (InvalidOperationException ex) when (ex.Message.Contains("server crashed during synthesis", StringComparison.Ordinal))
{
    Se.WriteToolsLog("CosyVoice3 server crashed mid-synth; retrying once after relaunch.", true);
    CosyVoice3CrispAsr.StopServer();
    await cosyVoice3Engine.Speak(text, out, voice, lang, region, model, ct);
}

Prevention

When it happens

Trigger: During synthesis, HttpClient.PostAsync raises HttpRequestException; the catch checks _serverProcess?.HasExited == true (server died) → the 'crashed during synthesis' branch fires; StopServerInternal is called to reap it.

Common situations: Synthesis OOM killing the server; a model/voice combination that crashes the backend on a particular input; the server hit an upstream assert and exited while streaming the response.

Related errors


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