HKUDS/nanobot · error · TypeError

{module_name}.PLUGIN declares name '{plugin.name}', expected

Error message

{module_name}.PLUGIN declares name '{plugin.name}', expected '{name}'

What it means

Error "{module_name}.PLUGIN declares name '{plugin.name}', expected '{name}'" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/channels/plugin.py:146

    """Return whether *name* owns a dependency-free package manifest."""
    if _CHANNEL_PACKAGE_NAME.fullmatch(name) is None:
        return False
    return files("nanobot.channels").joinpath(name, "manifest.py").is_file()


@lru_cache(maxsize=None)
def load_channel_package(name: str) -> ChannelPlugin | None:
    """Load one package manifest without importing its runtime."""
    if not has_channel_package(name):
        return None

    module_name = f"nanobot.channels.{name}.manifest"
    module = importlib.import_module(module_name)
    plugin = getattr(module, "PLUGIN", None)
    if not isinstance(plugin, ChannelPlugin):
        raise TypeError(f"{module_name}.PLUGIN must be a ChannelPlugin")
    if plugin.name != name:
        raise TypeError(
            f"{module_name}.PLUGIN declares name '{plugin.name}', expected '{name}'"
        )

    package_name = f"nanobot.channels.{name}"
    package_root = files("nanobot.channels").joinpath(name)
    targets = [("runtime", plugin.runtime)]
    if plugin.connector is not None:
        targets.append(("connector", plugin.connector))
    for label, target in targets:
        target_module, _ = _target_parts(target, label=label)
        if not target_module.startswith(f"{package_name}."):
            raise TypeError(
                f"{module_name}.PLUGIN {label} must stay inside {package_name}: "
                f"{target_module}"
            )
        target_parts = target_module.removeprefix(f"{package_name}.").split(".")
        target_file = package_root.joinpath(
            *target_parts[:-1],

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/channels/plugin.py:146 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/20ff9a6202e3461a. Report an issue: GitHub.