Comfy-Org/ComfyUI · error · Exception

Sonilo API returned no audio data.

Error message

Sonilo API returned no audio data.

What it means

Raised after the Sonilo streaming loop finishes (complete event or stream end) if no audio chunks were collected in any stream. The request technically succeeded but produced zero usable audio bytes, so joining/returning audio is impossible. It is the final guard before selecting a stream and returning bytes.

Source

Thrown at comfy_api_nodes/nodes_sonilo.py:251

                        audio_streams[stream_idx] = []
                    audio_streams[stream_idx].append(chunk_data)

                    now = time.monotonic()
                    if now - last_chunk_status_ts >= 1.0:
                        total_chunks = sum(len(chunks) for chunks in audio_streams.values())
                        elapsed = int(now - start_ts)
                        status_lines = ["Status: Receiving audio"]
                        if title:
                            status_lines.append(f"Title: {title}")
                        status_lines.append(f"Chunks received: {total_chunks}")
                        status_lines.append(f"Time elapsed: {elapsed}s")
                        PromptServer.instance.send_progress_text("\n".join(status_lines), node_id)
                        last_chunk_status_ts = now
                elif evt_type == "complete":
                    break

    if not audio_streams:
        raise Exception("Sonilo API returned no audio data.")

    PromptServer.instance.send_progress_text("Status: Completed", node_id)
    selected_stream = 0 if 0 in audio_streams else min(audio_streams)
    return b"".join(audio_streams[selected_stream])


async def _extract_error_message(resp: aiohttp.ClientResponse) -> str:
    """Extract a human-readable error message from an HTTP error response."""
    try:
        error_body = await resp.json()
        detail = error_body.get("detail", {})
        if isinstance(detail, dict):
            return detail.get("message", str(detail))
        return str(detail)
    except Exception:
        return await resp.text()

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Retry the generation — truncated streams are often transient
  2. Check network/proxy settings for buffering or early termination of streaming responses
  3. If persistent, inspect the raw NDJSON traffic to see whether audio events use a changed schema
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(2):
    try:
        return await _sonilo_generate(url, form, headers)
    except Exception as e:
        if "no audio data" in str(e) and attempt == 0:
            continue
        raise

Prevention

When it happens

Trigger: Stream completes without any audio chunk events — server closed early, only status/metadata events arrived, or all chunk events carried empty payloads so audio_streams stayed empty.

Common situations: Server-side truncation after moderation passed; network proxy cutting the stream body; Sonilo API changes emitting chunks under a different event type that the node ignores.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/0ff706f6e92a1938. Report an issue: GitHub.