Mintplex-Labs/anything-llm · error · Error
Failed to load or play TTS message response.
Error message
Failed to load or play TTS message response.
What it means
Per-message TTS playback. Workspace.ttsMessage(slug, chatId) requests synthesized audio and the .then handler expects a truthy Blob; when the promise resolves with a falsy value (empty body or an error response that produced no blob) this error is thrown inside the promise chain and routed to .catch, which toasts e.message.
Source
Thrown at frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/HistoricalMessage/Actions/TTSButton/asyncTts.jsx:26
const playerRef = useRef(null);
const [speaking, setSpeaking] = useState(false);
const [loading, setLoading] = useState(false);
const [audioSrc, setAudioSrc] = useState(null);
const { t } = useTranslation();
function speakMessage() {
if (speaking) {
playerRef?.current?.pause();
return;
}
try {
if (!audioSrc) {
setLoading(true);
Workspace.ttsMessage(slug, chatId)
.then((audioBlob) => {
if (!audioBlob)
throw new Error("Failed to load or play TTS message response.");
setAudioSrc(audioBlob);
})
.catch((e) => showToast(e.message, "error", { clear: true }))
.finally(() => setLoading(false));
} else {
playerRef.current.play();
}
} catch (e) {
console.error(e);
setLoading(false);
setSpeaking(false);
}
}
useEffect(() => {
function setupPlayer() {
if (!playerRef?.current) return;
playerRef.current.addEventListener("play", () => {View on GitHub (pinned to 3aec848f28)
Solutions
- Configure and test a TTS provider under Admin settings (voice/speech section)
- Inspect the network tab — the ttsMessage response is likely JSON containing the real error, not audio
- Verify the chat message still exists and the workspace slug in the URL is current
- Check quota/validity of the TTS provider's API key and retry
Defensive patterns
Strategy: type-guard
Validate before calling
const settings = await SystemSettings.fetch();
if (!settings?.tts_model_provider) return disableTtsButton("Configure a TTS provider first"); Type guard
function isAudioBlob(value) {
return value instanceof Blob && value.size > 0 && value.type.startsWith("audio/");
} Try / catch
.then((audioBlob) => {
if (!isAudioBlob(audioBlob))
throw new Error("Failed to load or play TTS message response.");
setAudioSrc(audioBlob);
})
.catch((e) => showToast(e.message, "error", { clear: true })) Prevention
- Hide or disable the speak button when no TTS provider is configured
- Type-check the response is a non-empty audio Blob before playing
- Distinguish provider-not-configured from synthesis failure in the toast so users know where to look
When it happens
Trigger: TTS provider not configured or disabled server-side so the endpoint returns JSON/error instead of audio; TTS API key invalid or quota exhausted; chatId/slug no longer valid so no message is found; response body empty due to a proxy stripping it.
Common situations: Clicking the speaker icon before configuring a TTS provider in admin settings; expired free-tier TTS quota; message deleted or workspace slug changed; CORS/proxy interfering with the audio response.
Related errors
- Failed to publish agent flow: ${error.message}
- Failed to publish slash command: ${error.message}
- Failed to publish prompt: ${error.message}
- An error occurred while downloading the model
- No ElevenLabs API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/5b516ff9c998a4dc.
Report an issue: GitHub.