{"record":{"id":"dc0f3dffe4094d30","repo":"sgl-project/sglang","slug":"pipeline-pipeline-name-is-already-registered","errorCode":null,"errorMessage":"Pipeline '{pipeline_name}' is already registered; pass overwrite=True to replace it","messagePattern":"Pipeline '(.+?)' is already registered; pass overwrite=True to replace it","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/registry.py","lineNumber":396,"sourceCode":"    pipeline_cls: Type[ComposedPipelineBase],\n    *,\n    sampling_param_cls: Any,\n    pipeline_config_cls: Type[PipelineConfig],\n    hf_model_paths: Optional[List[str]] = None,\n    model_detectors: Optional[List[Callable[[str], bool]]] = None,\n    overwrite: bool = False,\n) -> None:\n    \"\"\"Register an out-of-tree native diffusion pipeline and its configs.\"\"\"\n    _discover_and_register_pipelines()\n    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,","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/registry.py#L378-L414","documentation":"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.","triggerScenarios":"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.","commonSituations":"Notebook cell re-execution; module reimport triggering registration again; two plugins registering the same pipeline name; duplicate registration in tests without cleanup.","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)"],"exampleFix":"# before\nregister_pipeline(MyPipeline, MyConfig)  # second call raises\n# after\nregister_pipeline(MyPipeline, MyConfig, overwrite=True)\n# or\nif \"my_pipeline\" not in get_registered_pipeline_names():\n    register_pipeline(MyPipeline, MyConfig)","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen import registry\nname = MyPipeline.pipeline_name\nalready = name in getattr(registry, \"_PIPELINE_REGISTRY\", {}) or registry.get_pipeline(name) is not None\nif not already:\n    registry.register_pipeline(MyPipeline, MyConfig)\n# else: skip or pass overwrite=True","typeGuard":null,"tryCatchPattern":"try:\n    register_pipeline(MyPipeline, MyConfig)\nexcept ValueError as e:\n    if \"already registered\" in str(e) and \"overwrite=True\" in str(e):\n        register_pipeline(MyPipeline, MyConfig, overwrite=True)\n    else:\n        raise","preventionTips":["Make plugin registration idempotent (check registry before registering)","In notebooks, guard registration with a module-level flag","Use overwrite=True deliberately during development iterations"],"tags":["registry","duplicate","value-error","pipeline","idempotency"],"backgroundTag":"duplicate-registration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}