{"record":{"id":"dd95e5b51b8ec7c3","repo":"mudler/LocalAI","slug":"generate-music-failed","errorCode":null,"errorMessage":"generate_music failed","messagePattern":"generate_music failed","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"backend/python/ace-step/backend.py","lineNumber":277,"sourceCode":"        use_random_seed=bool(payload.get(\"use_random_seed\", True)),\n        seeds=payload.get(\"seeds\"),\n        lm_batch_chunk_size=max(1, int(payload.get(\"lm_batch_chunk_size\", 8))),\n        constrained_decoding_debug=bool(payload.get(\"constrained_decoding_debug\")),\n        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):","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/python/ace-step/backend.py#L259-L295","documentation":"Raised by the ACE-Step backend wrapper after the upstream generate_music() call reports failure (result.success is False). The message is the upstream result.error or result.status_message, or the generic 'generate_music failed' when the result carries neither. It means the music generation pipeline itself failed before producing any output.","triggerScenarios":"Calling the backend's generation entry point (which invokes generate_music with dit_handler, optional llm_handler, params, config and a temp save_dir) when the diffusion transformer pipeline errors out, is interrupted, or returns success=False with an empty error/status field.","commonSituations":"Missing or corrupt ACE-Step checkpoint files, out-of-memory on GPU during the DiT pass, an LLM handler that was passed while not fully initialized (the code passes None unless llm_initialized is True), or version drift between the backend and the ace-step pip package changing the result contract.","solutions":["Inspect the full traceback and the upstream result.error / result.status_message content — the generic message only appears when both are empty.","Verify the ACE-Step model snapshot is complete and the paths in config resolve (see require_snapshot_file errors for how the ref is resolved).","Check GPU memory availability and reduce params (e.g. fewer inference steps, shorter duration) to lower VRAM pressure.","If llm_handler-based generation is intended, confirm llm_handler.llm_initialized is True before the call, otherwise lyrics/tag generation silently runs without the LLM."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"params_ok = dit_handler is not None and (llm_handler is None or getattr(llm_handler, \"llm_initialized\", False))\nimport shutil\nfree = shutil.disk_usage(tempfile.gettempdir()).free\nassert params_ok and free > 1 << 30, \"preconditions for generate_music not met\"","typeGuard":null,"tryCatchPattern":"try:\n    run_ace_step_generation(params, config)\nexcept RuntimeError as e:\n    # message may be upstream result.error or status_message\n    logger.error(\"ace-step generation failed: %s\", e)\n    raise GenerationError(str(e)) from e","preventionTips":["Pre-validate the model snapshot with require_snapshot_file before constructing handlers.","Monitor GPU memory before generation; reject requests that exceed headroom.","Log the full result object on failure so empty result.error does not hide the cause."],"tags":["ace-step","music-generation","model-inference","runtime"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}