SubtitleEdit/subtitleedit · error · HttpRequestException

AllTalk TTS server is not reachable. Please check that the s

Error message

AllTalk TTS server is not reachable. Please check that the server is running.

What it means

HttpRequestException thrown when the POST to the AllTalk TTS server's /api/tts-generate endpoint fails with an HttpRequestException at the transport level (DNS, connection refused, TLS). The inner exception is preserved and SeLogger records the cause.

Source

Thrown at src/ui/Logic/Download/TtsDownloadService.cs:164

        multipartContent.Add(new StringContent(voice.Voice), "narrator_voice_gen");
        multipartContent.Add(new StringContent("character"), "text_not_inside");
        multipartContent.Add(new StringContent(language), "language");
        multipartContent.Add(new StringContent("output"), "output_file_name");
        multipartContent.Add(new StringContent("false"), "output_file_timestamp");
        multipartContent.Add(new StringContent("false"), "autoplay");
        multipartContent.Add(new StringContent("1.0"), "autoplay_volume");

        HttpResponseMessage result;
        try
        {
            // Honor the caller's token - a bulk-generate Cancel used to leave the AllTalk
            // request running to completion.
            result = await _httpClient.PostAsync(Se.Settings.Video.TextToSpeech.AllTalkUrl.TrimEnd('/') + "/api/tts-generate", multipartContent, cancellationToken);
        }
        catch (HttpRequestException ex)
        {
            SeLogger.Error(ex, "AllTalk TTS server connection failed.");
            throw new HttpRequestException("AllTalk TTS server is not reachable. Please check that the server is running.", ex);
        }
        catch (TaskCanceledException ex) when (!cancellationToken.IsCancellationRequested)
        {
            SeLogger.Error(ex, "AllTalk TTS server request timed out.");
            throw new HttpRequestException("AllTalk TTS server request timed out. Please check that the server is running.", ex);
        }

        using (result)
        {
            if (!result.IsSuccessStatusCode)
            {
                var errorBody = await result.Content.ReadAsStringAsync(cancellationToken);
                SeLogger.Error($"AllTalk TTS failed calling API at {_httpClient.BaseAddress}: Status code={result.StatusCode}" + Environment.NewLine + errorBody);
                throw new HttpRequestException($"AllTalk TTS server returned error {(int)result.StatusCode} ({result.StatusCode}).");
            }

            var bytes = await result.Content.ReadAsByteArrayAsync(cancellationToken);
            var resultJson = Encoding.UTF8.GetString(bytes);

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Start the AllTalk TTS server and confirm it is listening on AllTalkUrl.
  2. Verify Se.Settings.Video.TextToSpeech.AllTalkUrl is correct (scheme, host, port) and reachable from this host.
  3. Check firewall/security software isn't blocking the connection.
  4. Test the endpoint directly with curl to isolate app vs. server issues.
Defensive patterns

Strategy: try-catch

Validate before calling

var url = Se.Settings.Video.TextToSpeech.AllTalkUrl.TrimEnd('/') + "/api/tts-generate";
// cheap reachability probe before the heavy POST
try
{
    using var ping = await _httpClient.GetAsync(new Uri(url).GetLeftPart(UriPartial.Authority) + "/", ct);
}
catch (HttpRequestException)
{
    // server down; tell the user to start AllTalk before attempting generation
}

Try / catch

try { var audio = await ttsService.GenerateAllTalk(...); }
catch (HttpRequestException ex) when (ex.Message.Contains("not reachable"))
{
    // prompt user to start AllTalk; optionally retry after a short delay
}

Prevention

When it happens

Trigger: _httpClient.PostAsync to AllTalkUrl + "/api/tts-generate" throws HttpRequestException (not a non-2xx status - that path is handled separately). Caught, logged, and rewrapped with the user-facing message.

Common situations: AllTalk server not started, wrong host/port in AllTalkUrl, firewall blocking the port, DNS resolution failure, TLS/cert problem, or the server crashed mid-request.

Related errors


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