nanocoai/nanoclaw · error · Error

--channel-type, --platform-id and --text are required

Error message

--channel-type, --platform-id and --text are required

What it means

Thrown by `ncl messaging-groups inject` when any of --channel-type, --platform-id, or --text is missing. These three values are the minimum needed to locate the messaging group and construct the injected inbound message.

Source

Thrown at src/cli/resources/messaging-groups.ts:102

      );
      return;
    }
    // is_group carries its static default (0) only after this hook runs, so
    // treat "not provided" as the same DM context the static default means.
    const isGroup = Number(values.is_group ?? 0) === 1;
    values.unknown_sender_policy = resolveUnknownSenderPolicy(channelKey, isGroup, channelType);
  },
  customOperations: {
    send: {
      access: 'approval',
      description:
        'Inject a message into a messaging group as if a sender posted it, waking the wired agent — used to send a welcome on first wire. Use --channel-type, --platform-id, --text, optionally --instance, --sender-id, --sender.',
      handler: async (args) => {
        const channelType = args.channel_type as string;
        const platformId = args.platform_id as string;
        const text = args.text as string;
        if (!channelType || !platformId || !text) {
          throw new Error('--channel-type, --platform-id and --text are required');
        }
        const instance = (args.instance as string) ?? channelType;
        const mg = await getMessagingGroupByPlatform(channelType, platformId, instance);
        if (!mg) {
          throw new Error(`no messaging group for ${channelType} ${platformId} — create + wire it first`);
        }
        // Build the same InboundEvent the CLI admin transport (src/channels/cli.ts)
        // emits for a routed message, and route it in-process. The sender id should
        // be a wired user (e.g. the owner just granted) so the access gate passes.
        await routeInbound({
          channelType,
          instance,
          platformId,
          threadId: platformId,
          message: {
            id: `send-${randomUUID()}`,
            kind: 'chat',
            timestamp: new Date().toISOString(),

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Pass all three: `ncl messaging-groups inject --channel-type telegram --platform-id <chat-id> --text "hello"`
  2. Find the platform id via `ncl messaging-groups list`
  3. Add --instance only if the adapter runs under a non-default instance name

Example fix

// before
ncl messaging-groups inject --text "Welcome!"
// after
ncl messaging-groups inject --channel-type telegram --platform-id -1001234 --text "Welcome!"
Defensive patterns

Strategy: validation

Validate before calling

if (!channelType || !platformId || !text) throw new Error('inject requires channel-type, platform-id, text');

Prevention

When it happens

Trigger: Calling inject with only --text, omitting --platform-id, or passing the message body via a flag the handler does not read.

Common situations: Operator assumes the messaging group is resolved from an id or name instead of the (channelType, platformId, instance) triple; scripting with unset variables.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/5953367769e3e10c. Report an issue: GitHub.