{"record":{"id":"f65b13782cce8522","repo":"unslothai/unsloth","slug":"unknown-audio-type-audio-type","errorCode":null,"errorMessage":"Unknown audio_type: {audio_type}","messagePattern":"Unknown audio_type: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/inference.py","lineNumber":2135,"sourceCode":"                    stopping_criteria = stopping_criteria,\n                    cancel_event = cancel_event,\n                )\n            elif audio_type == \"dac\":\n                result = self._generate_dac(\n                    model,\n                    tokenizer,\n                    text,\n                    temperature,\n                    top_k,\n                    top_p,\n                    min_p,\n                    max_new_tokens,\n                    repetition_penalty,\n                    stopping_criteria = stopping_criteria,\n                    cancel_event = cancel_event,\n                )\n            else:\n                raise RuntimeError(f\"Unknown audio_type: {audio_type}\")\n            if cancel_event is not None and cancel_event.is_set():\n                raise RuntimeError(\"Audio generation cancelled\")\n            return result\n\n    def _generate_snac(\n        self,\n        model,\n        tokenizer,\n        text,\n        temperature,\n        top_p,\n        max_new_tokens,\n        repetition_penalty,\n        *,\n        stopping_criteria = None,\n        cancel_event = None,\n    ):\n        \"\"\"Generate audio using SNAC codec (Orpheus).\"\"\"","sourceCodeStart":2117,"sourceCodeEnd":2153,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/inference.py#L2117-L2153","documentation":"generate_audio dispatches on the active model's audio_type ('snac' and siblings); an audio_type that is set but matches no known codec branch falls through to RuntimeError('Unknown audio_type: {audio_type}'). This guards against registry entries claiming audio support with a codec this build cannot generate for.","triggerScenarios":"The active model's registry entry has audio_type set to a value outside the supported set (e.g. a new/experimental codec string or a corrupted config), reaching the else branch after the snac branch.","commonSituations":"Model config from a newer backend version naming a codec this build doesn't implement; custom/locally-edited model configs; registry pollution from a failed load writing partial entries.","solutions":["Check the model's config for the audio_type value and correct it to a supported codec","Update the backend to a build that supports the codec (e.g. via _generate_snac siblings)","Reload the model so its registry entry is rebuilt from its true config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"KNOWN = {\"snac\"}  # plus the other codecs this build implements\naudio_type = engine.models[engine.active_model_name].get(\"audio_type\")\nif audio_type not in KNOWN:\n    raise HTTPException(409, f\"Unsupported audio_type '{audio_type}' — update backend or fix model config\")","typeGuard":"def supported_audio_type(engine) -> bool:\n    return engine.models.get(engine.active_model_name, {}).get(\"audio_type\") in KNOWN_CODECS","tryCatchPattern":"try:\n    engine.generate_audio(text)\nexcept RuntimeError as e:\n    if str(e).startswith(\"Unknown audio_type:\"):\n        return JSONResponse(status_code=409, content={\"detail\": str(e)})\n    raise","preventionTips":["Validate audio_type against the backend's codec list before dispatch","Reload models after backend upgrades so registry entries refresh","Don't hand-edit model configs to claim audio codecs the engine lacks"],"tags":["tts","audio","dispatch","config"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}