{"record":{"id":"756b9fd2ff6533b3","repo":"agentscope-ai/agentscope","slug":"channel-type-channel-type-is-not-registered-p","errorCode":null,"errorMessage":"Channel type '{channel_type}' is not registered; pass it to create_app(channels=[...]).","messagePattern":"Channel type '(.+?)' is not registered; pass it to create_app\\(channels=\\[\\.\\.\\.\\]\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/app/channel/_registry.py","lineNumber":111,"sourceCode":"        channel_id: str,\n        credentials: dict,\n        config: dict,\n    ) -> \"ChannelBase\":\n        \"\"\"Validate stored credentials/config against the class's nested\n        models and build the channel instance.\n\n        Args:\n            channel_type (`str`): The platform type id.\n            channel_id (`str`): The instance's unique id.\n            credentials (`dict`): Raw credentials to validate.\n            config (`dict`): Raw platform options to validate.\n\n        Raises:\n            `ValueError`: If ``channel_type`` is not registered.\n        \"\"\"\n        channel_cls = self._classes.get(channel_type)\n        if channel_cls is None:\n            raise ValueError(\n                f\"Channel type '{channel_type}' is not registered; pass it \"\n                f\"to create_app(channels=[...]).\",\n            )\n        return channel_cls(\n            channel_id,\n            channel_cls.Credentials(**credentials),\n            channel_cls.Config(**config),\n        )\n\n    def schema_of(\n        self,\n        channel_cls: type[\"ChannelBase\"],\n    ) -> ChannelTypeSchema:\n        \"\"\"Build the frontend schema for one channel class.\n\n        Args:\n            channel_cls (`type[ChannelBase]`): The channel class.\n        \"\"\"","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/app/channel/_registry.py#L93-L129","documentation":"ValueError raised by ChannelRegistry.create_channel when asked to instantiate a channel whose channel_type string was never registered. Channels must be passed to create_app(channels=[...]) so the registry knows the class; creation by type id only works for registered classes.","triggerScenarios":"Calling registry.create_channel(\"telegram\", ...) (or an endpoint such as channel create/_start hitting it) when the Telegram channel class was not included in create_app(channels=[...]). Also typos in the channel_type string, or referencing a builtin channel whose class was never imported/registered.","commonSituations":"Adding a new channel type at runtime via the API without registering its class first, forgetting to list a channel in create_app, renaming a channel_type without updating stored configs, case/typo mismatches in the type string.","solutions":["Pass the channel class to create_app: create_app(channels=[TelegramChannel, ...]) before creating channels of that type","Verify the exact spelling of channel_type (it's the class attribute, not necessarily the class name)","If it's a custom channel, ensure its module is imported so registration happens","Log registry._classes keys (or expose a list endpoint) to see which types are actually available"],"exampleFix":"# before\napp = create_app(...)  # no channels\nch = registry.create_channel(\"feishu\", ...)\n\n# after\nfrom agentscope.app.channel import FeishuChannel\napp = create_app(channels=[FeishuChannel], ...)\nch = registry.create_channel(\"feishu\", ...)","handlingStrategy":"validation","validationCode":"registry = app.state.channel_registry\nif registry.get(\"telegram\") is None:\n    raise RuntimeError(\"telegram not registered; recreate app with channels=[TelegramChannel]\")","typeGuard":"def channel_available(registry, channel_type: str) -> bool:\n    return registry.get(channel_type) is not None","tryCatchPattern":"try:\n    ch = registry.create_channel(channel_type, ...)\nexcept ValueError as e:\n    if \"not registered\" in str(e):\n        return HTTPException(404, f\"unknown channel type {channel_type}\")","preventionTips":["Declare every channel class you intend to create via create_app(channels=[...])","Validate user-supplied channel_type strings against registry.get() before creating","Keep channel_type strings in one constants module to avoid typos"],"tags":["channel","registry","factory","configuration"],"backgroundTag":"unregistered-service-type","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}