{"record":{"id":"4b26a182236b7c21","repo":"HKUDS/nanobot","slug":"channel-plugin-self-name-runtime-declares-name","errorCode":null,"errorMessage":"Channel plugin '{self.name}' runtime declares name '{channel_cls.name}'","messagePattern":"Channel plugin '(.+?)' runtime declares name '(.+?)'","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"nanobot/channels/plugin.py","lineNumber":91,"sourceCode":"\n    def load_channel_class(self) -> type[BaseChannel]:\n        \"\"\"Resolve and validate the runtime class only when the channel is needed.\"\"\"\n        from nanobot.channels.base import BaseChannel\n\n        module_name, _, attr_name = self.runtime.partition(\":\")\n        module = importlib.import_module(module_name)\n        channel_cls: Any = getattr(module, attr_name, None)\n        if (\n            not isinstance(channel_cls, type)\n            or not issubclass(channel_cls, BaseChannel)\n            or channel_cls is BaseChannel\n        ):\n            raise ImportError(\n                f\"Channel plugin '{self.name}' runtime '{self.runtime}' \"\n                \"does not resolve to a BaseChannel subclass\"\n            )\n        if channel_cls.name != self.name:\n            raise ImportError(\n                f\"Channel plugin '{self.name}' runtime declares name '{channel_cls.name}'\"\n            )\n        return channel_cls\n\n    def load_connector(self) -> Any:\n        \"\"\"Construct the optional channel-owned interactive connector.\"\"\"\n        if self.connector is None:\n            raise ImportError(f\"Channel plugin '{self.name}' does not provide a connector\")\n        module_name, attr_name = _target_parts(self.connector, label=\"connector\")\n        module = importlib.import_module(module_name)\n        factory = getattr(module, attr_name, None)\n        if not callable(factory):\n            raise ImportError(\n                f\"Channel plugin '{self.name}' connector '{self.connector}' is not callable\"\n            )\n        connector = factory()\n        if not callable(getattr(connector, \"handle\", None)):\n            raise ImportError(","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/channels/plugin.py#L73-L109","documentation":"Consistency validation in load_channel_class: the resolved channel class's static name attribute differs from the ChannelPlugin.name in the manifest. The manifest name must match the runtime class name so config keys, discovery, and the class agree on the channel's identity.","triggerScenarios":"Thrown at nanobot/channels/plugin.py:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the class-level name on the runtime class to match the manifest PLUGIN.name","Or update PLUGIN.name to the value the runtime class declares"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","contentChangedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}