{"record":{"id":"894d9289bc8ceca9","repo":"unslothai/unsloth","slug":"controlnet-is-not-supported-for-the-fam-name-m","errorCode":null,"errorMessage":"ControlNet is not supported for the '{fam.name}' model family.","messagePattern":"ControlNet is not supported for the '(.+?)' model family\\.","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"studio/backend/core/inference/diffusion.py","lineNumber":4824,"sourceCode":"        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\n        ControlNet model. The ControlNet model is a small extra module loaded via from_pretrained\n        and cached by id; the pipeline is assembled with ``Pipeline.from_pipe(base,\n        controlnet=model)`` -- reusing the resident base modules at their loaded dtype (no reload,\n        no recast; torch_dtype=None for the same reason as _workflow_pipe). Raises a clear\n        ValueError when the family declares no ControlNet classes.\"\"\"\n        fam = state.family\n        pipe_cls_name = getattr(fam, \"controlnet_pipeline_class\", None)\n        model_cls_name = getattr(fam, \"controlnet_model_class\", None)\n        if not pipe_cls_name or not model_cls_name:\n            raise ValueError(f\"ControlNet is not supported for the '{fam.name}' model family.\")\n        import diffusers\n\n        cn_model = self._cn_models.get(resolved_cn.id)\n        if cn_model is None:\n            if cancel.is_set():\n                raise RuntimeError(DIFFUSION_CANCELLED_MSG)\n            # resolve_controlnet accepts a bare owner/name without the trust gate and from_pretrained would execute a malicious\n            # pickle, so run the same Hub malware preflight. It fails OPEN, so a remote repo also forces safetensors below.\n            remote_cn = not getattr(resolved_cn, \"is_local\", False)\n            if remote_cn:\n                from utils.security import evaluate_file_security\n                _cn_fs = evaluate_file_security(resolved_cn.path, hf_token = state.hf_token or None)\n                if _cn_fs.blocked:\n                    raise ValueError(_cn_fs.reason)\n            # Keep at most one ControlNet resident, else swapping ControlNets accumulates until OOM.\n            if self._cn_models or self._cn_pipes:\n                self._cn_models.clear()\n                self._cn_pipes.clear()","sourceCodeStart":4806,"sourceCodeEnd":4842,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/diffusion.py#L4806-L4842","documentation":"Raised by `_controlnet_pipe` when a ControlNet generation is requested but the model family declares neither `controlnet_pipeline_class` nor `controlnet_model_class`. ControlNet support is per-family: the loader needs both a diffusers pipeline class and a model class to assemble `Pipeline.from_pipe(base, controlnet=model)`. Missing attributes mean the family simply has no ControlNet integration, and the error is a clean ValueError.","triggerScenarios":"Calling generate() with a `controlnet` tuple (id, control_image_b64, control_type, strength, guidance_start, guidance_end) while the loaded state's family lacks `controlnet_pipeline_class` or `controlnet_model_class` attributes.","commonSituations":"Using ControlNet with a DiT family that has no ControlNet pipeline support yet; UI allowing ControlNet controls for every model; loading Flux/SD-family variants whose registry entry omits ControlNet classes.","solutions":["Remove the controlnet parameter from the generate call for this family.","Reload a model family that declares ControlNet support (one with controlnet_pipeline_class set).","If you own the family definitions, add the correct pipeline/model class names to enable ControlNet for that family."],"exampleFix":"# before\ndiffusion.generate(prompt=\"...\", controlnet=(cn_id, img_b64, \"canny\", 0.8, 0.0, 1.0))  # family lacks ControlNet\n# after\ndiffusion.generate(prompt=\"...\", controlnet=None)","handlingStrategy":"type-guard","validationCode":"fam = diffusion.loaded_family()\nif controlnet_spec is not None and not fam.controlnet_pipeline_class:\n    controlnet_spec = None  # or reject client-side","typeGuard":"def supports_controlnet(family) -> bool:\n    \"\"\"Family declares both pipeline and model classes for ControlNet.\"\"\"\n    return bool(getattr(family, \"controlnet_pipeline_class\", None)) and bool(getattr(family, \"controlnet_model_class\", None))","tryCatchPattern":"try:\n    diffusion.generate(prompt=p, controlnet=cn)\nexcept ValueError as e:\n    if \"ControlNet is not supported\" in str(e):\n        diffusion.generate(prompt=p)  # drop controlnet\n    else:\n        raise","preventionTips":["Gate ControlNet UI on the family capability flags from the load response.","Keep family registry entries complete: both controlnet_pipeline_class and controlnet_model_class are required.","Surface the family name in the error to users -- it names the unsupported family."],"tags":["diffusion","controlnet","model-family","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}