{"record":{"id":"0ebb17751882e8b8","repo":"unslothai/unsloth","slug":"workflow-is-not-supported-for-the-state-family","errorCode":null,"errorMessage":"{workflow} is not supported for the '{state.family.name}' model family.","messagePattern":"(.+?) is not supported for the '(.+?)' model family\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/inference/diffusion.py","lineNumber":4796,"sourceCode":"        return plan_diffusion_memory(\n            target = target,\n            device_memory = device_memory,\n            model_dense_mib = model_dense_mib,\n            companion_dense_mib = companion_mib,\n            text_encoder_dense_mib = text_encoder_mib,\n            runtime_headroom_mib = runtime_headroom,\n            requested_mode = memory_mode,\n            explicit_offload = cpu_offload,\n        )\n\n    def _workflow_pipe(self, state: _LoadState, class_name: Optional[str], workflow: str) -> Any:\n        \"\"\"The diffusers pipeline for an image-conditioned ``workflow``, built once and\n        cached. ``Pipeline.from_pipe`` re-wires the loaded text-to-image pipe's resident\n        modules (transformer/VAE/text-encoder, incl. any compiled/quantised state) into\n        the workflow pipeline class, so there is no extra VRAM and no reload. Raises a\n        clear ValueError when the family does not support the workflow.\"\"\"\n        if not class_name:\n            raise ValueError(\n                f\"{workflow} is not supported for the '{state.family.name}' model family.\"\n            )\n        cached = self._aux_pipes.get(class_name)\n        if cached is not None:\n            return cached\n        import diffusers\n\n        # torch_dtype=None is load-bearing: from_pipe otherwise recasts EVERY component to fp32, which hard-crashes the\n        # dense-quant path (torchao subclasses cannot swap_tensors). None reuses resident modules at their loaded dtype.\n        pipe = getattr(diffusers, class_name).from_pipe(state.pipe, torch_dtype = None)\n        # Publish to the shared aux cache only if THIS load is still current: from_pipe runs without _lock, so an unload can null _state and caching would hand out stale modules.\n        with self._lock:\n            if self._state is state:\n                self._aux_pipes[class_name] = pipe\n        return pipe\n\n    def _controlnet_pipe(self, state: _LoadState, resolved_cn: Any, cancel: threading.Event) -> Any:\n        \"\"\"Build (once, cached) the family's diffusers ControlNet pipeline around the requested","sourceCodeStart":4778,"sourceCodeEnd":4814,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/diffusion.py#L4778-L4814","documentation":"Raised by `_workflow_pipe` when an image-conditioned workflow (img2img, inpaint, etc.) is requested but the loaded model family does not declare a pipeline class for it (`class_name` is falsy). Each model family object carries a mapping of workflow names to diffusers pipeline class names; a family without the mapping cannot run that workflow. The error is intentionally a ValueError so API layers surface it as a client error.","triggerScenarios":"Calling generate() with a workflow like 'img2img' or 'inpaint' for a family whose workflow-class registry has no entry, e.g. an edit-only or t2i-only family. `_workflow_pipe(state, class_name, workflow)` is invoked after the class lookup fails.","commonSituations":"Frontends exposing all workflow buttons regardless of loaded model (offering inpaint on a model that only supports txt2img); loading a base checkpoint when the user selected an img2img workflow; new/lesser-known families added without complete workflow class mappings.","solutions":["Switch the workflow to one the family supports (typically txt2img) or reload a family that supports the requested workflow.","If you maintain the family registry, add the missing workflow->pipeline-class entry (e.g. controlnet_pipeline_class / img2img class) for that family.","In the UI, gate workflow options on the loaded family's declared capabilities instead of showing all."],"exampleFix":"# before\ndiffusion.generate(prompt=\"...\", workflow=\"inpaint\", mask_image=mask)  # family has no inpaint class\n# after\ndiffusion.generate(prompt=\"...\", workflow=\"txt2img\")  # or load a family that supports inpaint","handlingStrategy":"type-guard","validationCode":"fam = diffusion.loaded_family()\nif workflow not in fam.workflows:  # capability registry from the load response\n    workflow = \"txt2img\"","typeGuard":"def supports_workflow(family, workflow: str) -> bool:\n    \"\"\"Family declares a diffusers pipeline class for this workflow.\"\"\"\n    return bool(family.workflow_classes.get(workflow))","tryCatchPattern":"try:\n    diffusion.generate(prompt=p, workflow=wf)\nexcept ValueError as e:\n    if \"is not supported for the\" in str(e):\n        diffusion.generate(prompt=p, workflow=\"txt2img\")\n    else:\n        raise","preventionTips":["Drive UI workflow options from the loaded family's declared workflow list.","Treat 'not supported for family' ValueErrors as client errors (400), not server faults.","Test each family you ship against every workflow your UI exposes."],"tags":["diffusion","workflow","model-family","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}