fishaudio/fish-speech · error · HTTPException
{str(result.error)}
Error message
{str(result.error)} What it means
The streaming TTS wrapper maps internal 'error' results from the inference pipeline to HTTP 500 with the underlying error string as content. It is a pass-through of failures inside model inference (loading, encoding, generation).
Source
Thrown at tools/server/inference.py:25
from fish_speech.utils.schema import ServeTTSRequest
AMPLITUDE = 32768 # Needs an explaination
def inference_wrapper(req: ServeTTSRequest, engine: TTSInferenceEngine):
"""
Wrapper for the inference function.
Used in the API server.
"""
count = 0
for result in engine.inference(req):
match result.code:
case "header":
if isinstance(result.audio, tuple):
yield result.audio[1]
case "error":
raise HTTPException(
HTTPStatus.INTERNAL_SERVER_ERROR,
content=str(result.error),
)
case "segment":
count += 1
if isinstance(result.audio, tuple):
yield (result.audio[1] * AMPLITUDE).astype(np.int16).tobytes()
case "final":
count += 1
if isinstance(result.audio, tuple):
yield result.audio[1]
return None # Stop the generator
if count == 0:
raise HTTPException(
HTTPStatus.INTERNAL_SERVER_ERROR,View on GitHub (pinned to befe400174)
Solutions
- Read the returned content string and the server logs — it names the real underlying error
- Fix the root cause (model paths, memory, reference audio format)
- Reduce text length / batch to rule out OOM
Defensive patterns
Strategy: try-catch
Try / catch
try:
for chunk in stream_tts(client, req):
...
except HTTPError as e:
if e.response.status_code == 500:
log.error(e.response.text) # underlying error string Prevention
- Ship a healthcheck that loads the model before serving
- Validate model paths and reference audio at startup
When it happens
Trigger: Any exception raised during the serve pipeline — bad model path, unsupported request combination, OOM during generation — surfaces here as a 500 with the original message.
Common situations: Server started with mismatched model configs, corrupted audio references, CUDA OOM on long texts, or invalid parameters that pass request validation but break inference.
Related errors
- No audio generated, please check the input text.
- Failed to encode audio
- Failed to decode tokens to audio
- Expected GenerateResponse, got {type(wrapped_result.response
- Invalid token
AI-assisted analysis of fishaudio/fish-speech@befe400174 (2026-08-27).
Data as JSON: /api/errors/2758f8e3adc044cf.
Report an issue: GitHub.