{"record":{"id":"43f0cc5e5b258c57","repo":"mudler/LocalAI","slug":"generate-music-returned-no-audio","errorCode":null,"errorMessage":"generate_music returned no audio","messagePattern":"generate_music returned no audio","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"backend/python/ace-step/backend.py","lineNumber":281,"sourceCode":"        audio_format=(payload.get(\"audio_format\") or \"flac\").strip() or \"flac\",\n    )\n\n    save_dir = tempfile.mkdtemp(prefix=\"ace_step_\")\n    try:\n        result = generate_music(\n            dit_handler=dit_handler,\n            llm_handler=llm_handler if (llm_handler and getattr(llm_handler, \"llm_initialized\", False)) else None,\n            params=params,\n            config=config,\n            save_dir=save_dir,\n            progress=None,\n        )\n        if not result.success:\n            raise RuntimeError(result.error or result.status_message or \"generate_music failed\")\n\n        audios = result.audios or []\n        if not audios:\n            raise RuntimeError(\"generate_music returned no audio\")\n\n        first_path = audios[0].get(\"path\") or \"\"\n        if not first_path or not os.path.isfile(first_path):\n            raise RuntimeError(\"first generated audio path missing or not a file\")\n\n        shutil.copy2(first_path, dst_path)\n    finally:\n        try:\n            shutil.rmtree(save_dir, ignore_errors=True)\n        except Exception:\n            pass\n\n\nclass BackendServicer(backend_pb2_grpc.BackendServicer):\n    def __init__(self):\n        self.model_path = None\n        self.model_dir = None\n        self.checkpoint_dir = None","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/python/ace-step/backend.py#L263-L299","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check disk space and write permissions on the temp directory that hosts save_dir (tempfile.mkdtemp target).","Verify the installed ace-step version's generate_music contract actually populates result.audios on success; pin a known-good version if it changed.","Log the full result object (status_message, audios) to distinguish 'None audios' from 'empty list'.","Retry the request — if transient I/O caused a dropped write, a fresh save_dir may succeed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    generate(...)\nexcept RuntimeError as e:\n    if \"returned no audio\" in str(e):\n        # success-but-empty: safe to retry once with a fresh save_dir\n        return generate(...)\n    raise","preventionTips":["Pin the ace-step package version so the result.audios contract stays stable.","Ensure the temp volume has space and is writable before generation.","Treat success-with-empty-audios as retryable; it is usually transient I/O."],"tags":["ace-step","music-generation","empty-result","validation"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}