{"record":{"id":"8688e6d287993d57","repo":"vllm-project/vllm","slug":"connector-name-is-already-registered","errorCode":null,"errorMessage":"Connector '{name}' is already registered.","messagePattern":"Connector '(.+?)' is already registered\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/distributed/ec_transfer/ec_connector/factory.py","lineNumber":27,"sourceCode":"    ECConnectorBase,\n    ECConnectorRole,\n)\nfrom vllm.logger import init_logger\n\nif TYPE_CHECKING:\n    from vllm.config import ECTransferConfig, VllmConfig\n\nlogger = init_logger(__name__)\n\n\nclass ECConnectorFactory:\n    _registry: dict[str, Callable[[], type[ECConnectorBase]]] = {}\n\n    @classmethod\n    def register_connector(cls, name: str, module_path: str, class_name: str) -> None:\n        \"\"\"Register a connector with a lazy-loading module and class name.\"\"\"\n        if name in cls._registry:\n            raise ValueError(f\"Connector '{name}' is already registered.\")\n\n        def loader() -> type[ECConnectorBase]:\n            module = importlib.import_module(module_path)\n            return getattr(module, class_name)\n\n        cls._registry[name] = loader\n\n    @classmethod\n    def create_connector(\n        cls,\n        config: \"VllmConfig\",\n        role: ECConnectorRole,\n    ) -> ECConnectorBase:\n        ec_transfer_config = config.ec_transfer_config\n        if ec_transfer_config is None:\n            raise ValueError(\"ec_transfer_config must be set to create a connector\")\n        connector_cls = cls.get_connector_class(ec_transfer_config)\n        logger.info(","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/distributed/ec_transfer/ec_connector/factory.py#L9-L45","documentation":"ECConnectorFactory.register_connector() keeps a class-level dict mapping connector names to lazy loaders. Registering the same name twice would silently replace the first implementation — a likely bug when modules get imported twice or two connectors share a name — so it raises ValueError on duplicates.","triggerScenarios":"Calling register_connector('ECCPUConnector', ...) twice: e.g. the registration module being imported under two different names (package path and script path), or user code re-registering a built-in name to override it; a plugin re-running registration on hot-reload.","commonSituations":"Custom out-of-tree EC connectors that reuse a built-in name like 'ECExampleConnector'; test suites importing the factory module multiple times with importlib.reload; plugin systems that re-execute registration on config reload.","solutions":["Pick a unique connector name for your custom connector instead of overriding a built-in","If overriding is intended, pop the existing entry first: ECConnectorFactory._registry.pop(name, None) before register_connector","Avoid importlib.reload of modules containing registration calls, or guard registration with an `if name not in _registry` check"],"exampleFix":"# before\nECConnectorFactory.register_connector(\"ECExampleConnector\", my_module, \"MyCls\")\n# ValueError: Connector 'ECExampleConnector' is already registered.\n\n# after\nECConnectorFactory._registry.pop(\"ECExampleConnector\", None)\nECConnectorFactory.register_connector(\"ECExampleConnector\", my_module, \"MyCls\")","handlingStrategy":"validation","validationCode":"if name in ECConnectorFactory._registry:\n    ECConnectorFactory._registry.pop(name)  # intentional override\nECConnectorFactory.register_connector(name, module_path, class_name)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use unique connector names for out-of-tree connectors","Never importlib.reload modules that call register_connector","Centralize registration in one place per process"],"tags":["ec-transfer","plugin-registry","duplicate-registration"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}