Skip to content

Bug: clawdbot message --channel telegram fails with 'Unknown channel: telegram' (plugins not loaded in commander preAction) #1327

@fishfisher

Description

@fishfisher

Summary

Running clawdbot message send --channel telegram ... fails with Error: Unknown channel: telegram even though Telegram is configured and running.

This appears to happen because the Commander (non-route-first) code path does not load the plugin registry before resolving channel plugins, so getChannelPlugin('telegram') returns undefined.

Version

  • Clawdbot: 2026.1.17-1 (39dfdcc)
  • macOS: Darwin 25.2.0 (arm64)

Steps to reproduce

  1. Configure Telegram (works for inbound/outbound via normal agent replies).
  2. Run:
clawdbot message send --channel telegram --target "-100..." --message "test" --dry-run --json

Actual behavior

Command exits with:

Error: Unknown channel: telegram

Expected behavior

CLI should resolve the Telegram channel plugin and proceed (or at least produce a target-format error, not an unknown channel error).

Diagnosis

  • The fast CLI routing path (tryRouteCli) calls ensurePluginRegistryLoaded() when needed.
  • clawdbot message ... is handled via the Commander path (registerMessageCommands).
  • In the Commander path, preAction calls ensureConfigReady() but does not load the plugin registry, so channel plugins are not available.

This likely regressed around PR #1195 (CLI speedups / routing + config guards), which refactored src/cli/program/preaction.ts.

Workaround / Proposed fix

Load the plugin registry in preAction for commands that rely on plugins (e.g. message, channels, etc.), skipping only commands like setup/onboard/configure/config/reset/uninstall where plugin loading is unnecessary.

Example patch (conceptual):

import { ensurePluginRegistryLoaded } from "../plugin-registry.js";
...
await ensureConfigReady(...);
if (!skipPlugins.has(rootCommand)) ensurePluginRegistryLoaded();

Happy to submit a PR if you'd like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions