HKUDS/nanobot · error · ImportError

Channel plugin ' ' connector ' ' is not callable

Error message

Channel plugin '{self.name}' connector '{self.connector}' is not callable

What it means

Import validation in load_connector: the connector 'module:attribute' target imported successfully, but the attribute is not callable (missing, or a non-function object), so it cannot be used as a connector factory. The faulty input is the connector target string in the manifest.

Solutions

  1. Point PLUGIN.connector at a zero-argument factory function or class, e.g. '...connectors.x:make_connector'
  2. Fix typos in the attribute name of the connector target
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/channels/plugin.py:104 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/4a82a4c73eb35a9f. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/channels/plugin.py:104

            raise ImportError(
                f"Channel plugin '{self.name}' runtime '{self.runtime}' "
                "does not resolve to a BaseChannel subclass"
            )
        if channel_cls.name != self.name:
            raise ImportError(
                f"Channel plugin '{self.name}' runtime declares name '{channel_cls.name}'"
            )
        return channel_cls

    def load_connector(self) -> Any:
        """Construct the optional channel-owned interactive connector."""
        if self.connector is None:
            raise ImportError(f"Channel plugin '{self.name}' does not provide a connector")
        module_name, attr_name = _target_parts(self.connector, label="connector")
        module = importlib.import_module(module_name)
        factory = getattr(module, attr_name, None)
        if not callable(factory):
            raise ImportError(
                f"Channel plugin '{self.name}' connector '{self.connector}' is not callable"
            )
        connector = factory()
        if not callable(getattr(connector, "handle", None)):
            raise ImportError(
                f"Channel plugin '{self.name}' connector '{self.connector}' "
                "does not provide handle()"
            )
        return connector


def _target_parts(target: str, *, label: str) -> tuple[str, str]:
    module_name, separator, attr_name = target.partition(":")
    if not separator or not module_name or not attr_name:
        raise ValueError(f"channel plugin {label} must use 'module:attribute' syntax")
    if not all(part.isidentifier() for part in module_name.split(".")):
        raise ValueError(f"channel plugin {label} module must be an absolute import path")
    if not attr_name.isidentifier():

View on GitHub (pinned to 42f37dc4c0)