agentscope-ai/agentscope · error · NotImplementedError

This storage backend has no channel support.

Error message

This storage backend has no channel support.

What it means

StorageBase.upsert_channel is an optional part of the storage interface for channel (external platform) persistence. The base class raises NotImplementedError to signal that this backend does not support channels, so any caller that tries to persist a ChannelRecord through a non-channel-capable backend fails.

Source

Thrown at src/agentscope/app/storage/_base.py:641

        record: ChannelRecord,
        platform_bot_id: str,
    ) -> str:
        """Persist a channel record and refresh its indexes.

        ``record.id`` is a globally unique UUID, so the record lives at a
        single global key; ``record.user_id`` drives the per-user index
        and ``platform_bot_id`` (extracted from credentials by the
        caller) drives the uniqueness index.

        Args:
            record (`ChannelRecord`): The channel record to store.
            platform_bot_id (`str`): The platform-side bot identifier,
                used to maintain the dedup index.

        Returns:
            `str`: The id of the stored record.
        """
        raise NotImplementedError(
            "This storage backend has no channel support.",
        )

    async def get_channel(
        self,
        channel_id: str,
    ) -> ChannelRecord | None:
        """Fetch a channel record by its global id.

        This is the primary lookup, used both by the management API and
        by the channel runtime (which only has a channel_id in hand).

        Args:
            channel_id (`str`): The channel id.

        Returns:
            `ChannelRecord | None`: The record, or ``None`` if not found.
        """

View on GitHub (pinned to e90f1c7592)

Solutions

  1. Switch to a backend that implements channel support (e.g. AsyncSQLAlchemyStorage)
  2. If writing a custom backend, override upsert_channel (and the other channel methods) in your StorageBase subclass
  3. Disable/avoid channel features (channel routes, upsert flows) when using a channel-incapable backend

Example fix

# before
storage = MyMinimalStorage()
await storage.upsert_channel(record)  # NotImplementedError

# after
class MyStorage(StorageBase):
    async def upsert_channel(self, record, *, platform_bot_id=None) -> str:
        # persist ChannelRecord and index platform_bot_id
        ...
        return record.channel_id
Defensive patterns

Strategy: type-guard

Validate before calling

async def supports_channels(storage) -> bool:
    return storage.upsert_channel.__func__ is not StorageBase.upsert_channel

Type guard

def has_channel_support(storage) -> TypeGuard[ChannelCapableStorage]:
    return type(storage).upsert_channel is not StorageBase.upsert_channel

Try / catch

try:
    await storage.upsert_channel(record)
except NotImplementedError:
    logger.warning("backend %s has no channel support; skipping", type(storage).__name__)

Prevention

When it happens

Trigger: Registering a bot/channel on a storage backend that only implements session/agent persistence, then calling storage.upsert_channel(...) directly or via a channel-service route (create or update channel).

Common situations: Plugging a custom or minimal StorageBase subclass into an app that uses channel features; using a memory/file backend in production where the channel router expects SQL-backed channel persistence; upgrading agentscope to a version that added channel APIs the backend hasn't implemented.

Related errors


AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28). Data as JSON: /api/errors/98bf987c2f914acb. Report an issue: GitHub.