sgl-project/sglang · error · ValueError
Pipeline '{pipeline_name}' is already registered; pass overw
Error message
Pipeline '{pipeline_name}' is already registered; pass overwrite=True to replace it What it means
register_pipeline refuses to silently overwrite an existing entry: if pipeline_cls.pipeline_name already exists in _PIPELINE_REGISTRY and overwrite=False (the default), it raises ValueError telling you to pass overwrite=True.
Source
Thrown at python/sglang/multimodal_gen/registry.py:396
pipeline_cls: Type[ComposedPipelineBase],
*,
sampling_param_cls: Any,
pipeline_config_cls: Type[PipelineConfig],
hf_model_paths: Optional[List[str]] = None,
model_detectors: Optional[List[Callable[[str], bool]]] = None,
overwrite: bool = False,
) -> None:
"""Register an out-of-tree native diffusion pipeline and its configs."""
_discover_and_register_pipelines()
if not issubclass(pipeline_cls, ComposedPipelineBase):
raise TypeError("pipeline_cls must inherit from ComposedPipelineBase")
if not issubclass(pipeline_config_cls, PipelineConfig):
raise TypeError("pipeline_config_cls must inherit from PipelineConfig")
pipeline_name = pipeline_cls.pipeline_name
existing_pipeline = _PIPELINE_REGISTRY.get(pipeline_name)
if existing_pipeline is not None and not overwrite:
raise ValueError(
f"Pipeline '{pipeline_name}' is already registered; pass overwrite=True to replace it"
)
for model_path in hf_model_paths or []:
if model_path in _MODEL_HF_PATH_TO_NAME and not overwrite:
raise ValueError(f"Model path '{model_path}' is already registered")
registered_pipeline = KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS.get(
model_path.lower()
)
if registered_pipeline is not None and not overwrite:
raise ValueError(
f"Model path '{model_path}' is already registered for pipeline "
f"'{registered_pipeline}'"
)
_PIPELINE_REGISTRY[pipeline_name] = pipeline_cls
_PIPELINE_CONFIG_REGISTRY[pipeline_name] = (
pipeline_config_cls,
sampling_param_cls,View on GitHub (pinned to 0132848349)
Solutions
- Pass overwrite=True if you intentionally want to replace the existing pipeline
- Guard registration with a lookup (e.g. check the registry / get_pipeline first) to make it idempotent
- In notebooks or hot-reload scenarios, restructure so registration runs once (module-level flag or __main__ guard)
Example fix
# before
register_pipeline(MyPipeline, MyConfig) # second call raises
# after
register_pipeline(MyPipeline, MyConfig, overwrite=True)
# or
if "my_pipeline" not in get_registered_pipeline_names():
register_pipeline(MyPipeline, MyConfig) Defensive patterns
Strategy: validation
Validate before calling
from sglang.multimodal_gen import registry
name = MyPipeline.pipeline_name
already = name in getattr(registry, "_PIPELINE_REGISTRY", {}) or registry.get_pipeline(name) is not None
if not already:
registry.register_pipeline(MyPipeline, MyConfig)
# else: skip or pass overwrite=True Try / catch
try:
register_pipeline(MyPipeline, MyConfig)
except ValueError as e:
if "already registered" in str(e) and "overwrite=True" in str(e):
register_pipeline(MyPipeline, MyConfig, overwrite=True)
else:
raise Prevention
- Make plugin registration idempotent (check registry before registering)
- In notebooks, guard registration with a module-level flag
- Use overwrite=True deliberately during development iterations
When it happens
Trigger: Calling register_pipeline twice with classes sharing the same pipeline_name attribute — typically re-running registration in notebooks, hot-reload, or a plugin being loaded more than once.
Common situations: Notebook cell re-execution; module reimport triggering registration again; two plugins registering the same pipeline name; duplicate registration in tests without cleanup.
Related errors
- Model path '{model_path}' is already registered
- pipeline_cls must inherit from ComposedPipelineBase
- The quantization method `{quantization}` is already exists.
- LoRA with name {lora_ref.lora_name} already exists. Loaded L
- scalar_type_id {scalar_type_id} doesn't exists.
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/dc0f3dffe4094d30.
Report an issue: GitHub.