ScrapeGraphAI/Scrapegraph-ai · error · ValueError

No audio generated from the text.

Error message

No audio generated from the text.

What it means

SpeechGraph.run executes the TTS pipeline and then checks final_state.get('audio'); if it is None or empty (falsy), it raises ValueError('No audio generated from the text.') before saving the mp3. This means the audio-producing node did not write bytes into state — typically an upstream failure or a provider returning empty output.

Source

Thrown at scrapegraphai/graphs/speech_graph.py:120

            ],
            entry_point=fetch_node,
            graph_name=self.__class__.__name__,
        )

    def run(self) -> str:
        """
        Executes the scraping process and returns the answer to the prompt.

        Returns:
            str: The answer to the prompt.
        """

        inputs = {"user_prompt": self.prompt, self.input_key: self.source}
        self.final_state, self.execution_info = self.graph.execute(inputs)

        audio = self.final_state.get("audio", None)
        if not audio:
            raise ValueError("No audio generated from the text.")
        save_audio_from_bytes(audio, self.config.get("output_path", "output.mp3"))
        logger.info("Audio saved to %s", self.config.get("output_path", "output.mp3"))

        return self.final_state.get("answer", "No answer found.")

View on GitHub (pinned to 532dfffbf6)

Solutions

  1. Inspect self.final_state after catching the error to see which keys exist and whether 'answer' was produced.
  2. Verify the TTS provider credentials and quota in config (headless / tts options).
  3. If you customized nodes, ensure the final node stores bytes under state key 'audio'.
  4. Simplify the prompt or check the transcript for empty content and retry.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = speech_graph.run()
except ValueError as e:
    if 'No audio generated' in str(e):
        audio = speech_graph.final_state.get('audio')
        answer = speech_graph.final_state.get('answer')
        logger.error('TTS produced no audio; answer=%r', answer)
        raise

Prevention

When it happens

Trigger: The text-to-speech node failed silently, the state key 'audio' was overwritten by another node, the LLM/TTS provider returned empty content, or the answer node produced no text to synthesize.

Common situations: Invalid/expired TTS API key producing empty responses; the model outputting an empty answer for the given prompt; graph customization renaming or dropping the 'audio' state key; provider quota exhausted.

Related errors


AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28). Data as JSON: /api/errors/5fa1955bd6b804b8. Report an issue: GitHub.