{"record":{"id":"dcbb04f04ae20e28","repo":"SubtitleEdit/subtitleedit","slug":"alltalk-tts-server-request-timed-out-please-check","errorCode":null,"errorMessage":"AllTalk TTS server request timed out. Please check that the server is running.","messagePattern":"AllTalk TTS server request timed out\\. Please check that the server is running\\.","errorType":"exception","errorClass":"HttpRequestException","httpStatus":null,"severity":"error","filePath":"src/ui/Logic/Download/TtsDownloadService.cs","lineNumber":169,"sourceCode":"        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);\n\n            var jsonParser = new SeJsonParser();\n            var allTalkOutput = jsonParser.GetFirstObject(resultJson, \"output_file_path\");\n            return allTalkOutput.Replace(\"\\\\\\\\\", \"\\\\\");\n        }","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/ui/Logic/Download/TtsDownloadService.cs#L151-L187","documentation":"HttpRequestException raised when PostAsync to AllTalk throws a TaskCanceledException that is NOT the caller's cancellation token - i.e. the HttpClient timeout fired. Logged and rewrapped so the user sees a timeout-specific message.","triggerScenarios":"TaskCanceledException caught with a `when (!cancellationToken.IsCancellationRequested)` filter, meaning the request exceeded the HttpClient.Timeout rather than being user-cancelled.","commonSituations":"AllTalk server is slow/overloaded, generating a long clip on weak hardware, network latency, or the configured HttpClient.Timeout is too low for the workload.","solutions":["Confirm the AllTalk server is responsive (try a short test generation).","Increase HttpClient.Timeout for this client if generations legitimately take long.","Check server load / GPU utilization on the AllTalk host.","Verify network throughput between client and server."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (_httpClient.Timeout < TimeSpan.FromSeconds(60))\n{\n    // AllTalk generations can exceed default timeout; raise it for this client\n    _httpClient.Timeout = TimeSpan.FromSeconds(120);\n}","typeGuard":null,"tryCatchPattern":"try { var audio = await ttsService.GenerateAllTalk(...); }\ncatch (HttpRequestException ex) when (ex.Message.Contains(\"timed out\"))\n{\n    // one bounded retry with a longer timeout; if it fails again, surface the message\n    _httpClient.Timeout = TimeSpan.FromSeconds(120);\n    await ttsService.GenerateAllTalk(...);\n}","preventionTips":["Size HttpClient.Timeout to the longest legitimate generation.","Confirm the AllTalk server isn't overloaded before retrying.","Avoid retries on the caller's own cancellation token."],"tags":["network","http","timeout","tts","alltalk","csharp"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}