{"record":{"id":"21483fcf5dac5852","repo":"SubtitleEdit/subtitleedit","slug":"alltalk-tts-server-is-not-reachable-please-check","errorCode":null,"errorMessage":"AllTalk TTS server is not reachable. Please check that the server is running.","messagePattern":"AllTalk TTS server is not reachable\\. Please check that the server is running\\.","errorType":"exception","errorClass":"HttpRequestException","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/Download/TtsDownloadService.cs","lineNumber":164,"sourceCode":"        multipartContent.Add(new StringContent(voice.Voice), \"narrator_voice_gen\");\n        multipartContent.Add(new StringContent(\"character\"), \"text_not_inside\");\n        multipartContent.Add(new StringContent(language), \"language\");\n        multipartContent.Add(new StringContent(\"output\"), \"output_file_name\");\n        multipartContent.Add(new StringContent(\"false\"), \"output_file_timestamp\");\n        multipartContent.Add(new StringContent(\"false\"), \"autoplay\");\n        multipartContent.Add(new StringContent(\"1.0\"), \"autoplay_volume\");\n\n        HttpResponseMessage result;\n        try\n        {\n            // Honor the caller's token - a bulk-generate Cancel used to leave the AllTalk\n            // request running to completion.\n            result = await _httpClient.PostAsync(Se.Settings.Video.TextToSpeech.AllTalkUrl.TrimEnd('/') + \"/api/tts-generate\", multipartContent, cancellationToken);\n        }\n        catch (HttpRequestException ex)\n        {\n            SeLogger.Error(ex, \"AllTalk TTS server connection failed.\");\n            throw new HttpRequestException(\"AllTalk TTS server is not reachable. Please check that the server is running.\", ex);\n        }\n        catch (TaskCanceledException ex) when (!cancellationToken.IsCancellationRequested)\n        {\n            SeLogger.Error(ex, \"AllTalk TTS server request timed out.\");\n            throw new HttpRequestException(\"AllTalk TTS server request timed out. Please check that the server is running.\", ex);\n        }\n\n        using (result)\n        {\n            if (!result.IsSuccessStatusCode)\n            {\n                var errorBody = await result.Content.ReadAsStringAsync(cancellationToken);\n                SeLogger.Error($\"AllTalk TTS failed calling API at {_httpClient.BaseAddress}: Status code={result.StatusCode}\" + Environment.NewLine + errorBody);\n                throw new HttpRequestException($\"AllTalk TTS server returned error {(int)result.StatusCode} ({result.StatusCode}).\");\n            }\n\n            var bytes = await result.Content.ReadAsByteArrayAsync(cancellationToken);\n            var resultJson = Encoding.UTF8.GetString(bytes);","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/TtsDownloadService.cs#L146-L182","documentation":"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.","triggerScenarios":"_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.","commonSituations":"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.","solutions":["Start the AllTalk TTS server and confirm it is listening on AllTalkUrl.","Verify Se.Settings.Video.TextToSpeech.AllTalkUrl is correct (scheme, host, port) and reachable from this host.","Check firewall/security software isn't blocking the connection.","Test the endpoint directly with curl to isolate app vs. server issues."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"var url = Se.Settings.Video.TextToSpeech.AllTalkUrl.TrimEnd('/') + \"/api/tts-generate\";\n// cheap reachability probe before the heavy POST\ntry\n{\n    using var ping = await _httpClient.GetAsync(new Uri(url).GetLeftPart(UriPartial.Authority) + \"/\", ct);\n}\ncatch (HttpRequestException)\n{\n    // server down; tell the user to start AllTalk before attempting generation\n}","typeGuard":null,"tryCatchPattern":"try { var audio = await ttsService.GenerateAllTalk(...); }\ncatch (HttpRequestException ex) when (ex.Message.Contains(\"not reachable\"))\n{\n    // prompt user to start AllTalk; optionally retry after a short delay\n}","preventionTips":["Validate AllTalkUrl (scheme/host/port) before invoking generation.","Show a connection health check in the TTS settings UI.","Keep the inner exception chained for diagnostics (the code already does this)."],"tags":["network","http","tts","alltalk","csharp"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}