{"record":{"id":"ccc527c94d8560f5","repo":"vllm-project/vllm","slug":"unknown-ecconnectorrole-role","errorCode":null,"errorMessage":"Unknown ECConnectorRole: {role}","messagePattern":"Unknown ECConnectorRole: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/distributed/ec_transfer/ec_connector/cpu/connector.py","lineNumber":46,"sourceCode":"\nlogger = init_logger(__name__)\n\n\nclass ECCPUConnector(ECConnectorBase):\n    \"\"\"EC connector that offloads encoder cache to a shared CPU mmap region.\"\"\"\n\n    def __init__(self, vllm_config: \"VllmConfig\", role: ECConnectorRole) -> None:\n        super().__init__(vllm_config=vllm_config, role=role)\n\n        self.connector_worker = None\n        self.connector_scheduler = None\n\n        if role == ECConnectorRole.WORKER:\n            self.connector_worker = self._make_worker(vllm_config)\n        elif role == ECConnectorRole.SCHEDULER:\n            self.connector_scheduler = self._make_scheduler(vllm_config)\n        else:\n            raise ValueError(f\"Unknown ECConnectorRole: {role}\")\n\n    # Construction seams.\n    def _make_worker(self, vllm_config: \"VllmConfig\"):\n        # Deferred import: the worker module touches torch/CUDA at import time\n        # via the region, so keep that cost off the scheduler path.\n        from vllm.distributed.ec_transfer.ec_connector.cpu.worker import (\n            ECCPUWorker,\n        )\n\n        return ECCPUWorker(vllm_config)\n\n    def _make_scheduler(self, vllm_config: \"VllmConfig\"):\n        from vllm.distributed.ec_transfer.ec_connector.cpu.scheduler import (\n            ECCPUScheduler,\n        )\n\n        return ECCPUScheduler(vllm_config)\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/distributed/ec_transfer/ec_connector/cpu/connector.py#L28-L64","documentation":"ECCPUConnector dispatches on the ECConnectorRole enum in __init__: WORKER builds a connector_worker, SCHEDULER builds a connector_scheduler, and anything else (an unknown enum value or an int/str passed instead of the enum) raises ValueError. The two-role split exists because scheduler and worker processes get different connector behavior.","triggerScenarios":"Passing a raw string like \"worker\" or an int instead of ECConnectorRole.WORKER/ECConnectorRole.SCHEDULER; a new ECConnectorRole member added to the enum without updating this if/elif chain; calling the connector with role=None in tests.","commonSituations":"Custom entrypoints constructing the connector directly instead of via ECConnectorFactory.create_connector (which validates roles); enum extensions during development of new EC roles.","solutions":["Pass the enum: ECConnectorRole.WORKER or ECConnectorRole.SCHEDULER","Prefer ECConnectorFactory.create_connector(config, role) which is the supported construction path","If you added a new role to ECConnectorRole, add a matching branch (or convert the chain to a dispatch map) in the connector"],"exampleFix":"# before\nconnector = ECCPUConnector(vllm_config, role=\"worker\")\n# ValueError: Unknown ECConnectorRole: worker\n\n# after\nfrom vllm.distributed.ec_transfer.ec_connector.base import ECConnectorRole\nconnector = ECCPUConnector(vllm_config, role=ECConnectorRole.WORKER)","handlingStrategy":"type-guard","validationCode":"from vllm.distributed.ec_transfer.ec_connector.base import ECConnectorRole\nassert role in (ECConnectorRole.WORKER, ECConnectorRole.SCHEDULER)","typeGuard":"def is_supported_role(role) -> bool:\n    return role in (ECConnectorRole.WORKER, ECConnectorRole.SCHEDULER)","tryCatchPattern":null,"preventionTips":["Pass ECConnectorRole enum members, never strings or ints","Construct connectors via ECConnectorFactory.create_connector","When adding enum members, update every role-dispatch chain"],"tags":["api-misuse","ec-transfer","enum"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}