unslothai/unsloth · error · ValueError

is not supported for the ' ' model family.

Error message

{workflow} is not supported for the '{state.family.name}' model family.

What it means

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.

Solutions

  1. Switch the workflow to one the family supports (typically txt2img) or reload a family that supports the requested workflow.
  2. If you maintain the family registry, add the missing workflow->pipeline-class entry (e.g. controlnet_pipeline_class / img2img class) for that family.
  3. In the UI, gate workflow options on the loaded family's declared capabilities instead of showing all.

Example fix

# before
diffusion.generate(prompt="...", workflow="inpaint", mask_image=mask)  # family has no inpaint class
# after
diffusion.generate(prompt="...", workflow="txt2img")  # or load a family that supports inpaint
Defensive patterns

Strategy: type-guard

Validate before calling

fam = diffusion.loaded_family()
if workflow not in fam.workflows:  # capability registry from the load response
    workflow = "txt2img"

Type guard

def supports_workflow(family, workflow: str) -> bool:
    """Family declares a diffusers pipeline class for this workflow."""
    return bool(family.workflow_classes.get(workflow))

Try / catch

try:
    diffusion.generate(prompt=p, workflow=wf)
except ValueError as e:
    if "is not supported for the" in str(e):
        diffusion.generate(prompt=p, workflow="txt2img")
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/0ebb17751882e8b8. Report an issue: GitHub.

Appendix: source

Thrown at studio/backend/core/inference/diffusion.py:4796

        return plan_diffusion_memory(
            target = target,
            device_memory = device_memory,
            model_dense_mib = model_dense_mib,
            companion_dense_mib = companion_mib,
            text_encoder_dense_mib = text_encoder_mib,
            runtime_headroom_mib = runtime_headroom,
            requested_mode = memory_mode,
            explicit_offload = cpu_offload,
        )

    def _workflow_pipe(self, state: _LoadState, class_name: Optional[str], workflow: str) -> Any:
        """The diffusers pipeline for an image-conditioned ``workflow``, built once and
        cached. ``Pipeline.from_pipe`` re-wires the loaded text-to-image pipe's resident
        modules (transformer/VAE/text-encoder, incl. any compiled/quantised state) into
        the workflow pipeline class, so there is no extra VRAM and no reload. Raises a
        clear ValueError when the family does not support the workflow."""
        if not class_name:
            raise ValueError(
                f"{workflow} is not supported for the '{state.family.name}' model family."
            )
        cached = self._aux_pipes.get(class_name)
        if cached is not None:
            return cached
        import diffusers

        # torch_dtype=None is load-bearing: from_pipe otherwise recasts EVERY component to fp32, which hard-crashes the
        # dense-quant path (torchao subclasses cannot swap_tensors). None reuses resident modules at their loaded dtype.
        pipe = getattr(diffusers, class_name).from_pipe(state.pipe, torch_dtype = None)
        # 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.
        with self._lock:
            if self._state is state:
                self._aux_pipes[class_name] = pipe
        return pipe

    def _controlnet_pipe(self, state: _LoadState, resolved_cn: Any, cancel: threading.Event) -> Any:
        """Build (once, cached) the family's diffusers ControlNet pipeline around the requested

View on GitHub (pinned to 203007d190)