mudler/LocalAI · error · RuntimeError

generate_music returned no audio

Error message

generate_music returned no audio

What it means

Raised when generate_music() returns success=True but result.audios is None or an empty list. The generation pipeline claims success yet produced zero audio artifacts, so the backend refuses to continue rather than copying a nonexistent file.

Source

Thrown at backend/python/ace-step/backend.py:281

        audio_format=(payload.get("audio_format") or "flac").strip() or "flac",
    )

    save_dir = tempfile.mkdtemp(prefix="ace_step_")
    try:
        result = generate_music(
            dit_handler=dit_handler,
            llm_handler=llm_handler if (llm_handler and getattr(llm_handler, "llm_initialized", False)) else None,
            params=params,
            config=config,
            save_dir=save_dir,
            progress=None,
        )
        if not result.success:
            raise RuntimeError(result.error or result.status_message or "generate_music failed")

        audios = result.audios or []
        if not audios:
            raise RuntimeError("generate_music returned no audio")

        first_path = audios[0].get("path") or ""
        if not first_path or not os.path.isfile(first_path):
            raise RuntimeError("first generated audio path missing or not a file")

        shutil.copy2(first_path, dst_path)
    finally:
        try:
            shutil.rmtree(save_dir, ignore_errors=True)
        except Exception:
            pass


class BackendServicer(backend_pb2_grpc.BackendServicer):
    def __init__(self):
        self.model_path = None
        self.model_dir = None
        self.checkpoint_dir = None

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Check disk space and write permissions on the temp directory that hosts save_dir (tempfile.mkdtemp target).
  2. Verify the installed ace-step version's generate_music contract actually populates result.audios on success; pin a known-good version if it changed.
  3. Log the full result object (status_message, audios) to distinguish 'None audios' from 'empty list'.
  4. Retry the request — if transient I/O caused a dropped write, a fresh save_dir may succeed.
Defensive patterns

Strategy: validation

Try / catch

try:
    generate(...)
except RuntimeError as e:
    if "returned no audio" in str(e):
        # success-but-empty: safe to retry once with a fresh save_dir
        return generate(...)
    raise

Prevention

When it happens

Trigger: result.success is True and (result.audios or []) evaluates empty — i.e. audios is None, an empty list, or the pipeline finished but wrote no audio files into save_dir.

Common situations: Upstream ace-step version that returns a success result before asynchronously writing files, a save_dir permissions/disk-full issue that silently drops file writes, or audio export (e.g. ffmpeg/wav encoding) failing inside the pipeline without propagating an error.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/43f0cc5e5b258c57. Report an issue: GitHub.