{"record":{"id":"7d89e00a58989028","repo":"sgl-project/sglang","slug":"model-path-model-path-is-already-registered","errorCode":null,"errorMessage":"Model path '{model_path}' is already registered","messagePattern":"Model path '(.+?)' is already registered","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/registry.py","lineNumber":401,"sourceCode":"    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,\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,","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/registry.py#L383-L419","documentation":"The hf_model_paths loop in register_pipeline also rejects duplicates: if any provided HuggingFace model path is already present in _MODEL_HF_PATH_TO_NAME and overwrite is False, registration raises ValueError before adding the mapping.","triggerScenarios":"Calling register_pipeline(..., hf_model_paths=[\"org/model-name\"]) where \"org/model-name\" (or a colliding path) is already present in _MODEL_HF_PATH_TO_NAME — from a built-in registration or a previous call — while overwrite is False.","commonSituations":"Registering a pipeline for a model path that sglang already knows (built-in registry entry); re-running registration in notebooks/tests; case-insensitive collisions via KNOWN_NON_DIFFUSERS_DIFFUSION_MODEL_PATTERNS.","solutions":["Pass overwrite=True to replace the existing mapping for those model paths","Choose a different/distinct hf_model_path string for your pipeline","Check the existing mapping first and skip registration if the path is already bound to your pipeline"],"exampleFix":"# before\nregister_pipeline(MyPipeline, MyConfig, hf_model_paths=[\"org/model-v1\"])\n# after\nregister_pipeline(MyPipeline, MyConfig, hf_model_paths=[\"org/model-v1\"], overwrite=True)","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen import registry\npaths = [\"org/model-v1\"]\nunknown = [p for p in paths if p in getattr(registry, \"_MODEL_HF_PATH_TO_NAME\", {})]\nif unknown:\n    register_pipeline(MyPipeline, MyConfig, hf_model_paths=paths, overwrite=True)\nelse:\n    register_pipeline(MyPipeline, MyConfig, hf_model_paths=paths)","typeGuard":null,"tryCatchPattern":"try:\n    register_pipeline(MyPipeline, MyConfig, hf_model_paths=paths)\nexcept ValueError as e:\n    if \"already registered\" in str(e):\n        register_pipeline(MyPipeline, MyConfig, hf_model_paths=paths, overwrite=True)\n    else:\n        raise","preventionTips":["Check for existing model-path mappings before registering","Use unique model-path strings for custom pipelines","Pass overwrite=True when intentionally rebinding a path"],"tags":["registry","duplicate","value-error","model-path","hf-hub"],"backgroundTag":"duplicate-registration","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}