SubtitleEdit/subtitleedit · error · InvalidOperationException

crispasr (f5-tts) exited during startup (code {exitCode}). O

Error message

crispasr (f5-tts) exited during startup (code {exitCode}). Output: {tail}{LaunchCmdSuffix}

What it means

The F5-TTS engine spawns the `crispasr` binary as a loopback child server and polls its `/health` endpoint. This InvalidOperationException is thrown from the startup loop in EnsureServerRunningAsync when `process.HasExited` becomes true before the first successful health probe — the server died while still initializing. The message carries the raw exit code, the last 2000 chars of captured stdout/stderr, and the exact launch command so you can reproduce the failure manually.

Source

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

            HookProcessExitOnce();

            // First-run auto-download (~953 MB talker) needs a generous timeout.
            var deadline = DateTime.UtcNow.AddMinutes(hasLocalTalker ? 5 : 20);
            while (DateTime.UtcNow < deadline)
            {
                ct.ThrowIfCancellationRequested();
                if (process.HasExited)
                {
                    var tail = SnapshotServerLog();
                    var exitCode = process.ExitCode;
                    var exitedLaunchCommand = _serverLaunchCommand;
                    _serverProcess = null;
                    _serverPort = 0;
                    _serverLaunchCommand = null;
                    _serverModelKey = null;
                    _serverVoicePath = null;
                    _serverRefText = null;
                    throw new InvalidOperationException(
                        $"crispasr (f5-tts) exited during startup (code {exitCode}). Output: {tail}"
                        + LaunchCmdSuffix(exitedLaunchCommand));
                }
                if (await ProbeHealthAsync(port, TimeSpan.FromSeconds(2), ct))
                {
                    return;
                }
                await Task.Delay(TimeSpan.FromSeconds(1), ct);
            }

            var lastOutput = SnapshotServerLog();
            var timeoutLaunchCommand = _serverLaunchCommand;
            StopServerInternal();
            throw new TimeoutException(
                $"crispasr (f5-tts) did not report healthy within {(hasLocalTalker ? 5 : 20)} minutes. Last output: {lastOutput}"
                + LaunchCmdSuffix(timeoutLaunchCommand));
        }
        finally

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Read the `Output:` tail in the message — the server's own stderr names the real cause (e.g. `CUDA error: no kernel image`, `model file not found`).
  2. Copy the `Launch command:` line and run it in a terminal to see the full untruncated error.
  3. Verify the talker GGUF at the path from GetTalkerPath(modelKey) is non-zero bytes; if missing, let `--auto-download` re-fetch on a stable connection.
  4. Add the CrispASR install folder to antivirus exclusions and retry.
  5. If the GPU/CUDA stack is broken, install a CPU-only CrispASR build or update the GPU driver to match the release notes.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: confirm exe + talker model before invoking Speak
var exe = engine.GetCrispAsrExecutable(); // via reflection/internal access if exposed
if (!File.Exists(exe)) { WarnUser("Install CrispASR first"); return; }
if (!engine.HasLocalModel(modelKey)) { WarnUser("First run will download ~953 MB; keep the network stable."); }

Try / catch

try
{
    var result = await f5Engine.Speak(text, outFolder, voice, lang, region, model, ct);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("exited during startup"))
{
    // Surface exit code + Output tail to the user; offer a manual command to reproduce.
    ShowDiagnostics(ex.Message);
    // Do NOT auto-retry in a tight loop — the cause (missing model, AV, CUDA) must be fixed first.
}

Prevention

When it happens

Trigger: Calling Speak() (→ EnsureServerRunningAsync) when the talker/codec GGUF is missing or corrupt and `--auto-download` fails; when the f5-tts backend hits a CUDA/runtime error at boot; when antivirus quarantines `crispasr.exe`; when a stale file lock holds the model open. The check fires only inside the 5/20-minute startup window before ProbeHealthAsync ever succeeds.

Common situations: First run after install where the ~953 MB talker download was interrupted; CrispASR upgraded to a version whose CLI flags changed; a GPU driver update broke the bundled CUDA runtime; corporate AV silently killing the process.

Related errors


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