SubtitleEdit/subtitleedit · critical · InvalidOperationException

qwen3-tts-server exited during startup (code {NativeExitCode

Error message

qwen3-tts-server exited during startup (code {NativeExitCodeHelper.Describe(process.ExitCode)}). {hint} Output: {tail}

What it means

Thrown during the startup health-wait loop when process.HasExited becomes true before the /health probe ever succeeds. The message includes NativeExitCodeHelper.Describe(ExitCode) (which translates 0xC00000xx loader-killed codes into human hints) and the captured stderr tail so the user can see why the server died pre-main.

Source

Thrown at src/ui/Features/Video/TextToSpeech/Engines/Qwen3TtsCpp.cs:422

            _serverPort = port;
            _serverModelFileName = modelFileName;
            _serverStderr = stderrBuffer;
            HookProcessExitOnce();

            var deadline = DateTime.UtcNow.AddSeconds(120);
            while (DateTime.UtcNow < deadline)
            {
                ct.ThrowIfCancellationRequested();
                if (process.HasExited)
                {
                    var tail = SnapshotStderr(stderrBuffer);
                    _serverProcess = null;
                    _serverPort = 0;
                    _serverModelFileName = null;
                    // An empty tail plus a 0xC00000xx code means the loader killed it before main -
                    // NativeExitCodeHelper explains those instead of just printing the raw number.
                    var hint = NativeExitCodeHelper.GetHint(process.ExitCode, "Qwen3 TTS", GetSetFolder());
                    throw new InvalidOperationException(
                        $"qwen3-tts-server exited during startup (code {NativeExitCodeHelper.Describe(process.ExitCode)})."
                        + (hint == null ? string.Empty : " " + hint)
                        + $" Output: {tail}");
                }
                if (await ProbeHealthAsync(port, TimeSpan.FromSeconds(1), ct))
                {
                    return;
                }
                await Task.Delay(TimeSpan.FromMilliseconds(500), ct);
            }

            var lastOutput = SnapshotStderr(stderrBuffer);
            StopServerInternal();
            throw new TimeoutException(
                $"qwen3-tts-server did not report healthy within 120s. Last output: {lastOutput}");
        }
        finally
        {

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Read the hint from NativeExitCodeHelper — a 0xC00000xx code points at a missing DLL/loader problem, not a logic error.
  2. Check the appended Output tail for the server's own fatal line (e.g. 'failed to load model', 'vulkan: no capable device').
  3. Install/repair the Vulkan runtime and GPU drivers, then retry.
  4. Verify the model file named in --model-name exists and is a complete, non-truncated download.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: confirm required runtime libs/model files exist before spawning.
if (!File.Exists(Path.Combine(GetSetModelsFolder(), modelFileName)))
    throw new FileNotFoundException("Model file missing", modelFileName);

Try / catch

try { await EnsureServerRunningAsync(modelFileName, ct); }
catch (InvalidOperationException ex) when (ex.Message.Contains("exited during startup"))
{
    // Read NativeExitCodeHelper hint + stderr tail; guide the user to install Vulkan/runtime.
    await ShowServerStartupHelpAsync(ex.Message);
    throw;
}

Prevention

When it happens

Trigger: Missing or incompatible shared libraries (Vulkan runtime, CUDA stubs) cause the loader to kill the process with 0xC0000135/0xC000007B before main; the model GGUF path is wrong so the server aborts during init; the talker/codec files are corrupt; GPU driver mismatch.

Common situations: First run after a GPU driver update broke Vulkan; model files partially downloaded; running on a machine without the Visual C++ runtime the server links against; the --model-name passed doesn't match any file in the models folder.

Related errors


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