HKUDS/nanobot · error · TypeError

channel plugin dependencies must be a tuple of requirements

Error message

channel plugin dependencies must be a tuple of requirements

What it means

Type guard in ChannelPlugin.__post_init__: dependencies is not a tuple of non-empty strings — e.g. it was given a list, or an entry is blank/whitespace. Dependencies drive automated dependency installation for the channel, so the descriptor must be a well-formed requirements tuple.

Solutions

  1. Declare dependencies as a tuple of requirement strings, e.g. ('pyjwt[crypto]',)
  2. Remove empty or whitespace-only entries from the tuple
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at nanobot/channels/plugin.py:60 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/0339bd05c3a0af04. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/channels/plugin.py:60

    def __post_init__(self) -> None:
        if _CHANNEL_PACKAGE_NAME.fullmatch(self.name) is None:
            raise ValueError(
                "channel plugin name must start with a letter and contain only letters, "
                "digits, or underscores"
            )
        _target_parts(self.runtime, label="runtime")
        if self.connector is not None:
            _target_parts(self.connector, label="connector")
        if self.setup is not None and not isinstance(cast(object, self.setup), ChannelSetupSpec):
            raise TypeError("channel plugin setup must be a ChannelSetupSpec or None")
        if not isinstance(cast(object, self.management), ChannelManagementSpec):
            raise TypeError("channel plugin management must be a ChannelManagementSpec")
        if not isinstance(cast(object, self.dependencies), tuple) or not all(
            isinstance(cast(object, requirement), str) and requirement.strip()
            for requirement in self.dependencies
        ):
            raise TypeError("channel plugin dependencies must be a tuple of requirements")
        for dependency in self.dependencies:
            try:
                Requirement(dependency)
            except InvalidRequirement as exc:
                raise ValueError(
                    f"channel plugin dependency is not a valid requirement: {dependency}"
                ) from exc
        if self.webui is not None:
            webui = self.webui.replace("\\", "/")
            if webui.startswith("/") or ".." in webui.split("/"):
                raise ValueError("channel plugin webui entry must stay inside its package")
            object.__setattr__(self, "webui", webui)

    def load_channel_class(self) -> type[BaseChannel]:
        """Resolve and validate the runtime class only when the channel is needed."""
        from nanobot.channels.base import BaseChannel

        module_name, _, attr_name = self.runtime.partition(":")

View on GitHub (pinned to 42f37dc4c0)