SubtitleEdit/subtitleedit · error · InvalidOperationException

Failed to start crispasr (f5-tts)

Error message

Failed to start crispasr (f5-tts)

What it means

InvalidOperationException thrown when Process.Start(psi) returns null while launching the f5-tts server. On modern .NET Process.Start throws rather than returning null, so this guard is defensive/unreachable; hitting it implies the runtime returned a null process handle.

Source

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

            psi.ArgumentList.Add("--port");
            psi.ArgumentList.Add(port.ToString());
            psi.ArgumentList.Add("--voice-dir");
            psi.ArgumentList.Add(GetSetVoicesFolder());
            CrispAsrTtsProvenance.AddServerMarkingArgs(psi.ArgumentList, exe);

            if (UseStartupVoiceFlags)
            {
                psi.ArgumentList.Add("--voice");
                psi.ArgumentList.Add(voicePath);
                if (!string.IsNullOrEmpty(refText))
                {
                    psi.ArgumentList.Add("--ref-text");
                    psi.ArgumentList.Add(refText);
                }
            }

            var process = Process.Start(psi)
                ?? throw new InvalidOperationException("Failed to start crispasr (f5-tts)");

            var launchCommand = FormatLaunchCommand(exe, psi.ArgumentList);
            _serverLaunchCommand = launchCommand;
            Se.WriteToolsLog("F5-TTS (CrispASR) server starting — "
                + $"PID: {process.Id}, "
                + $"Cmd: {launchCommand}");

            lock (_serverLog) _serverLog.Clear();
            process.ErrorDataReceived += (_, e) =>
            {
                if (e.Data != null) lock (_serverLog) _serverLog.AppendLine(e.Data);
            };
            process.OutputDataReceived += (_, e) =>
            {
                if (e.Data != null) lock (_serverLog) _serverLog.AppendLine(e.Data);
            };
            process.BeginErrorReadLine();
            process.BeginOutputReadLine();

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Treat as a runtime/platform anomaly — check the .NET runtime version and host.
  2. Re-run on a supported .NET runtime where Process.Start throws with a real error.
  3. If reproducing, capture the ProcessStartInfo state and report against the runtime.
Defensive patterns

Strategy: try-catch

Try / catch

try { await f5TtsEngine.Speak(text, out, voice, lang, region, model, ct); }
catch (InvalidOperationException ex) when (ex.Message == "Failed to start crispasr (f5-tts)")
{
    Se.WriteToolsLog("Runtime returned null from Process.Start; report platform/runtime anomaly.", true);
}

Prevention

When it happens

Trigger: Process.Start(psi) with the fully-built f5-tts ProcessStartInfo evaluates to null under the null-coalescing throw. Requires a platform/runtime quirk where Start returns null instead of throwing.

Common situations: Essentially unreachable on .NET 6+; hypothetically a broken Process implementation or a heavily constrained host returning null handles.

Related errors


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