sgl-project/sglang · error · ValueError

Model path '{model_path}' is already registered for pipeline

Error message

Model path '{model_path}' is already registered for pipeline '{registered_pipeline}'

What it means

register_pipeline keeps a map KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS from lowercase model paths to built-in pipeline names. When the path being registered matches one of these known patterns and overwrite=False, registration is rejected because it would shadow a built-in pipeline mapping. This is a separate check from the _MODEL_HF_PATH_TO_NAME duplicate check just above it.

Source

Thrown at python/sglang/multimodal_gen/registry.py:406

    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,
    )
    config_id = register_configs(
        sampling_param_cls=sampling_param_cls,
        pipeline_config_cls=pipeline_config_cls,
        hf_model_paths=hf_model_paths,
        model_detectors=None if overwrite else model_detectors,
    )
    if overwrite and model_detectors:
        _MODEL_NAME_DETECTORS[:0] = [
            (config_id, detector) for detector in model_detectors

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass overwrite=True if you intentionally want to replace the registered pipeline.
  2. Use a different, non-conflicting model_path (e.g. a fine-tuned local path or unique identifier).
  3. Check KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS to confirm the conflict and pick a path not in it.
  4. Guard registration code so it is idempotent and doesn't run twice.

Example fix

// before
register_pipeline(model_path="some/known-model", pipeline_cls=MyPipeline)
// after
register_pipeline(model_path="my-org/known-model-ft", pipeline_cls=MyPipeline, overwrite=True)
Defensive patterns

Strategy: validation

Validate before calling

from sglang.multimodal_gen.registry import register_pipeline

if model_path in _MODEL_HF_PATH_TO_NAME or model_path.lower() in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS:
    if not overwrite:
        raise SystemExit(f"conflict: {model_path} already registered; pass overwrite=True")
register_pipeline(model_path=model_path, pipeline_cls=cls, overwrite=overwrite)

Type guard

def is_free_model_path(model_path: str, overwrite: bool = False) -> bool:
    return (
        overwrite
        or (
            model_path not in _MODEL_HF_PATH_TO_NAME
            and model_path.lower() not in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS
        )
    )

Try / catch

try:
    register_pipeline(...)
except ValueError as e:
    if "already registered" in str(e):
        register_pipeline(..., overwrite=True)  # or log and skip
    else:
        raise

Prevention

When it happens

Trigger: Calling register_pipeline(model_path=...) where model_path.lower() is a key in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS, without overwrite=True.

Common situations: Registering a custom pipeline for a well-known HF diffusion model path during plugin/extension init that runs twice; a newer sglang version adding your previously-unused path to the known patterns table; fork builds re-registering built-ins at import time.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/0fc92fdbacec689d. Report an issue: GitHub.