{"record":{"id":"0fc92fdbacec689d","repo":"sgl-project/sglang","slug":"model-path-model-path-is-already-registered-fo","errorCode":null,"errorMessage":"Model path '{model_path}' is already registered for pipeline '{registered_pipeline}'","messagePattern":"Model path '(.+?)' is already registered for pipeline '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/registry.py","lineNumber":406,"sourceCode":"    if not issubclass(pipeline_cls, ComposedPipelineBase):\n        raise TypeError(\"pipeline_cls must inherit from ComposedPipelineBase\")\n    if not issubclass(pipeline_config_cls, PipelineConfig):\n        raise TypeError(\"pipeline_config_cls must inherit from PipelineConfig\")\n\n    pipeline_name = pipeline_cls.pipeline_name\n    existing_pipeline = _PIPELINE_REGISTRY.get(pipeline_name)\n    if existing_pipeline is not None and not overwrite:\n        raise ValueError(\n            f\"Pipeline '{pipeline_name}' is already registered; pass overwrite=True to replace it\"\n        )\n    for model_path in hf_model_paths or []:\n        if model_path in _MODEL_HF_PATH_TO_NAME and not overwrite:\n            raise ValueError(f\"Model path '{model_path}' is already registered\")\n        registered_pipeline = KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS.get(\n            model_path.lower()\n        )\n        if registered_pipeline is not None and not overwrite:\n            raise ValueError(\n                f\"Model path '{model_path}' is already registered for pipeline \"\n                f\"'{registered_pipeline}'\"\n            )\n\n    _PIPELINE_REGISTRY[pipeline_name] = pipeline_cls\n    _PIPELINE_CONFIG_REGISTRY[pipeline_name] = (\n        pipeline_config_cls,\n        sampling_param_cls,\n    )\n    config_id = register_configs(\n        sampling_param_cls=sampling_param_cls,\n        pipeline_config_cls=pipeline_config_cls,\n        hf_model_paths=hf_model_paths,\n        model_detectors=None if overwrite else model_detectors,\n    )\n    if overwrite and model_detectors:\n        _MODEL_NAME_DETECTORS[:0] = [\n            (config_id, detector) for detector in model_detectors","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/registry.py#L388-L424","documentation":"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.","triggerScenarios":"Calling register_pipeline(model_path=...) where model_path.lower() is a key in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS, without overwrite=True.","commonSituations":"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.","solutions":["Pass overwrite=True if you intentionally want to replace the registered pipeline.","Use a different, non-conflicting model_path (e.g. a fine-tuned local path or unique identifier).","Check KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS to confirm the conflict and pick a path not in it.","Guard registration code so it is idempotent and doesn't run twice."],"exampleFix":"// before\nregister_pipeline(model_path=\"some/known-model\", pipeline_cls=MyPipeline)\n// after\nregister_pipeline(model_path=\"my-org/known-model-ft\", pipeline_cls=MyPipeline, overwrite=True)","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen.registry import register_pipeline\n\nif model_path in _MODEL_HF_PATH_TO_NAME or model_path.lower() in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS:\n    if not overwrite:\n        raise SystemExit(f\"conflict: {model_path} already registered; pass overwrite=True\")\nregister_pipeline(model_path=model_path, pipeline_cls=cls, overwrite=overwrite)","typeGuard":"def is_free_model_path(model_path: str, overwrite: bool = False) -> bool:\n    return (\n        overwrite\n        or (\n            model_path not in _MODEL_HF_PATH_TO_NAME\n            and model_path.lower() not in KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS\n        )\n    )","tryCatchPattern":"try:\n    register_pipeline(...)\nexcept ValueError as e:\n    if \"already registered\" in str(e):\n        register_pipeline(..., overwrite=True)  # or log and skip\n    else:\n        raise","preventionTips":["Check _MODEL_HF_PATH_TO_NAME and KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS before registering.","Make plugin registration idempotent (skip if the name already maps to the same class).","Only pass overwrite=True when you genuinely intend to shadow a built-in pipeline."],"tags":["registry","pipeline-registration","diffusers","duplicate-entry"],"backgroundTag":"duplicate-registration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}