{"record":{"id":"0158ef51d8cfbb9a","repo":"agentscope-ai/agentscope","slug":"duplicate-kind-hub-id-hub-hub-id-r-hub-ids-mu","errorCode":null,"errorMessage":"Duplicate {kind} hub id {hub.hub_id!r}: hub ids must be unique so routes address exactly one hub.","messagePattern":"Duplicate (.+?) hub id (.+?): hub ids must be unique so routes address exactly one hub\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/_app.py","lineNumber":70,"sourceCode":"    Args:\n        hubs (`list | None`):\n            The hubs passed to :func:`create_app`.\n        kind (`str`):\n            The hub kind, used in the error message.\n\n    Returns:\n        `dict`:\n            The hubs keyed by :attr:`HubBase.hub_id`.\n\n    Raises:\n        `ValueError`:\n            When two hubs of the same kind share an id, which would make\n            them indistinguishable in the routes.\n    \"\"\"\n    indexed: dict[str, HubBase] = {}\n    for hub in hubs or []:\n        if hub.hub_id in indexed:\n            raise ValueError(\n                f\"Duplicate {kind} hub id {hub.hub_id!r}: hub ids must be \"\n                f\"unique so routes address exactly one hub.\",\n            )\n        indexed[hub.hub_id] = hub\n    return indexed\n\n\ndef create_app(\n    storage: StorageBase,\n    message_bus: MessageBus,\n    workspace_manager: WorkspaceManagerBase,\n    knowledge_base_manager: KnowledgeBaseManagerBase | None = None,\n    knowledge_parsers: list[ParserBase] | dict[str, ParserBase] | None = None,\n    knowledge_chunkers: list[Type[ChunkerBase]] | None = None,\n    blob_store: BlobStoreBase | None = None,\n    enable_index_worker: bool = True,\n    mcp_hubs: list[MCPHubBase] | None = None,\n    skill_hubs: list[SkillHubBase] | None = None,","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/_app.py#L52-L88","documentation":"create_app validates that hub ids are unique per kind; two hubs (e.g. channel hubs, session hubs) sharing a hub_id make route addressing ambiguous, so startup fails fast with this ValueError.","triggerScenarios":"Passing two hubs of the same kind with an identical hub_id to create_app, e.g. two ChannelHubs both defaulting to hub_id='default'.","commonSituations":"Adding a second hub of a kind without overriding its default hub_id; merging configurations where each section defines its own default hub; copy-pasting hub definitions.","solutions":["Give each hub a distinct hub_id when constructing them","Audit the hubs list passed to create_app for default ids ('default') collisions","If only one hub per kind is intended, remove the duplicate"],"exampleFix":"# before\napp = create_app(hubs=[ChannelHub(...), ChannelHub(...)])  # both 'default'\n\n# after\napp = create_app(hubs=[\n    ChannelHub(hub_id=\"slack\", ...),\n    ChannelHub(hub_id=\"discord\", ...),\n])","handlingStrategy":"validation","validationCode":"def hub_ids_unique(hubs) -> bool:\n    seen = {}\n    for h in hubs:\n        if h.hub_id in seen:\n            return False\n        seen[h.hub_id] = h\n    return True","typeGuard":null,"tryCatchPattern":"try:\n    app = create_app(hubs=hubs)\nexcept ValueError as e:\n    if \"Duplicate\" in str(e) and \"hub id\" in str(e):\n        # rename conflicting hubs and retry\n        ...","preventionTips":["Always set explicit hub_id when adding a second hub of a kind","Assert hub id uniqueness in app bootstrap tests"],"tags":["agentscope","app","hubs","duplicate-id","startup"],"backgroundTag":"duplicate-resource-identifier","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}