{"record":{"id":"8bd6913ca2d30b0c","repo":"mudler/LocalAI","slug":"failed-to-load-pipeline-effective-pipeline-type","errorCode":null,"errorMessage":"Failed to load pipeline '{effective_pipeline_type}': {e}\\nAvailable pipelines: {', '.join(available[:30])}...","messagePattern":"Failed to load pipeline '(.+?)': (.+?)\\\\nAvailable pipelines: (.+?)\\.\\.\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/python/diffusers/backend.py","lineNumber":495,"sourceCode":"        # Add device_map for multi-GPU support (when TensorParallelSize > 1)\n        if device_map:\n            load_kwargs[\"device_map\"] = device_map\n\n        # Determine pipeline class name - default to AutoPipelineForText2Image\n        effective_pipeline_type = pipeline_type if pipeline_type else \"AutoPipelineForText2Image\"\n\n        # Use dynamic loader for all pipelines\n        try:\n            pipe = load_diffusers_pipeline(\n                class_name=effective_pipeline_type,\n                model_id=model_ref,\n                from_single_file=from_single_file,\n                **load_kwargs\n            )\n        except Exception as e:\n            # Provide helpful error with available pipelines\n            available = get_available_pipelines()\n            raise ValueError(\n                f\"Failed to load pipeline '{effective_pipeline_type}': {e}\\n\"\n                f\"Available pipelines: {', '.join(available[:30])}...\"\n            ) from e\n\n        # Apply LowVRAM optimization if supported and requested\n        if request.LowVRAM and hasattr(pipe, 'enable_model_cpu_offload'):\n            pipe.enable_model_cpu_offload()\n\n        return pipe\n\n    def Health(self, request, context):\n        return backend_pb2.Reply(message=bytes(\"OK\", 'utf-8'))\n\n    def LoadModel(self, request, context):\n        try:\n            print(f\"Loading model {request.Model}...\", file=sys.stderr)\n            print(f\"Request {request}\", file=sys.stderr)\n            torchType = torch.float32","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/python/diffusers/backend.py#L477-L513","documentation":"Raised by the diffusers backend's _load_pipeline when load_diffusers_pipeline() throws while constructing the requested pipeline class. The message chains the original exception and appends up to 30 available pipeline class names so the user can see what this diffusers install actually supports.","triggerScenarios":"effective_pipeline_type resolves to a class whose from_pretrained/from_single_file load fails — missing model files, incompatible diffusers version lacking that class's required deps (e.g. transformers/k-diffusion), corrupted snapshot, or wrong pipeline type for the model files present.","commonSituations":"Specifying PipelineType that does not match the model (e.g. StableDiffusionXLPipeline against a Flux checkpoint), an older pinned diffusers version in the backend image missing a newer pipeline, or a partially downloaded model directory.","solutions":["Read the chained original exception ({e}) — it carries the root cause; the 'Available pipelines' list is only a hint.","Match the pipeline class to the model family (SD1.5→StableDiffusionPipeline, SDXL→StableDiffusionXLPipeline, Flux→FluxPipeline, etc.).","Upgrade the backend image / diffusers package if the class exists upstream but not in the available list.","Re-download the model snapshot if the underlying error is a missing/corrupt weight file."],"exampleFix":"# before\nrequest.PipelineType = \"StableDiffusionPipeline\"  # model is SDXL\n\n# after\nrequest.PipelineType = \"StableDiffusionXLPipeline\"","handlingStrategy":"try-catch","validationCode":"available = set(get_available_pipelines())\nassert effective_pipeline_type in available, (\n    f\"pipeline {effective_pipeline_type} not available; known: {sorted(available)[:30]}\")","typeGuard":null,"tryCatchPattern":"try:\n    pipe = _load_pipeline(request, model_ref, ...)\nexcept ValueError as e:\n    # message already contains the underlying cause and available pipelines\n    logger.error(\"pipeline load failed: %s\", e)\n    return error_reply(str(e))","preventionTips":["Match pipeline class to model family before sending the request.","Log the chained cause, not just the wrapper message.","Cache get_available_pipelines() at startup and validate PipelineType against it."],"tags":["diffusers","pipeline-loading","model-mismatch","image-generation"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}