{"record":{"id":"29fe41b668a26d88","repo":"SillyTavern/SillyTavern","slug":"tts-generation-failed-error","errorCode":null,"errorMessage":"TTS Generation Failed: ${error}","messagePattern":"TTS Generation Failed: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"src/endpoints/volcengine.js","lineNumber":134,"sourceCode":"                    } catch (e) {\n                        reject(`Error parsing final Volcengine TTS stream line: ${e}`);\n                    }\n                }\n                resolve(audioChunks_);\n            });\n\n            response.body.on('error', (error) => {\n                reject(`Error reading Volcengine TTS stream: ${error}`);\n            });\n        });\n\n        const finalAudioData = Buffer.concat(result);\n\n        res.set('Content-Type', 'audio/mpeg');\n        res.status(200).send(finalAudioData);\n    } catch (error) {\n        console.error('Volcengine generate-voice fetch failed', error);\n        res.status(500).send(`TTS Generation Failed: ${error}`);\n    }\n});\n","sourceCodeStart":116,"sourceCodeEnd":137,"githubUrl":"https://github.com/SillyTavern/SillyTavern/blob/8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8/src/endpoints/volcengine.js#L116-L137","documentation":"HTTP 500 with body `TTS Generation Failed: <error>` from the route's outer catch. Any thrown exception during the fetch — network failure, DNS, TLS, or a rejected stream read promise (`Error reading Volcengine TTS stream`) — is caught here and stringified into the response.","triggerScenarios":"fetch() rejects (no network, DNS failure, TLS error, provider_endpoint unreachable), response.body is null (reject 'Response body is null'), or response.body emits 'error' mid-stream causing the promise to reject with the stream error string.","commonSituations":"Server has no outbound internet or is behind a proxy that blocks the Volcengine host; custom provider_endpoint is wrong/unreachable; TLS cert chain issue; connection dropped mid-stream; response had no body (e.g. 204 or HEAD-like).","solutions":["Check outbound connectivity from the server to openspeech.bytedance.com (or the custom endpoint) — curl the endpoint.","If behind a proxy, configure HTTP_PROXY/HTTPS_PROXY or the app's proxy settings.","Inspect the server log: `console.error('Volcengine generate-voice fetch failed', error)` shows the real cause (ENOTFOUND, ECONNRESET, certificate error).","Handle null response.body by validating response.ok and presence of body before streaming.","Retry with backoff for transient network errors."],"exampleFix":"// before\nresponse.body.on('error', (error) => { reject(`Error reading Volcengine TTS stream: ${error}`); });\n// after - typed rejection + null-body guard\nif (!response.ok || !response.body) { reject(new Error(`No TTS stream (status ${response.status})`)); return; }\nresponse.body.on('error', (err) => { reject(new Error(`TTS stream read failed: ${err.message}`)); });","handlingStrategy":"retry","validationCode":"// confirm reachability before streaming\nconst probe = await fetch(endpoint, { method:'HEAD' }).catch(() => null);\nif (!probe) throw new Error('Volcengine endpoint unreachable');","typeGuard":null,"tryCatchPattern":"try { /* fetch + stream */ } catch (e) { if (isTransientNetError(e)) { await backoff(); retry(); } else { console.error(e); res.status(500).send(`TTS Generation Failed: ${e.message}`); } }","preventionTips":["Configure outbound proxy if the network requires it.","Guard against null response.body before streaming.","Surface the real errno from the server log."],"tags":["volcengine","tts","network","streams","http-500"],"backgroundTag":null,"analyzedSha":"8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8","analyzedAt":"2026-08-13T07:48:40.832Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}