nanocoai/nanoclaw · error · Error

messaging group not found: ${id}

Error message

messaging group not found: ${id}

What it means

Thrown by requireMessagingGroup in the ncl CLI wiring resource when a messaging group lookup by the given id returns nothing. The CLI refuses to operate on a wiring whose messaging group does not exist in the central DB.

Source

Thrown at src/cli/resources/wirings.ts:36

import type { MessagingGroup, MessagingGroupAgent } from '../../types.js';
import { registerResource } from '../crud.js';
import { projectDestinationsToSessions } from './destinations.js';

/**
 * Pass-1 parity with the generic create: enum validation for explicit flags
 * (the custom `create` below bypasses genericCreate, which would otherwise
 * reject e.g. `--engage-mode bogus`).
 */
const CREATE_ENUMS: Record<string, string[]> = {
  engage_mode: ['pattern', 'mention', 'mention-sticky'],
  sender_scope: ['all', 'known'],
  ignored_message_policy: ['drop', 'accumulate'],
  session_mode: ['shared', 'per-thread', 'agent-shared'],
};

async function requireMessagingGroup(id: unknown): Promise<MessagingGroup> {
  const mg = await getMessagingGroup(String(id));
  if (!mg) throw new Error(`messaging group not found: ${id}`);
  return mg;
}

/** --threads accepts true/false (or 1/0); stored as INTEGER 1/0. Omitted =
 *  column NULL = inherit the channel declaration. */
function normalizeThreads(v: unknown): number {
  if (v === true || v === 'true' || v === '1' || v === 1) return 1;
  if (v === false || v === 'false' || v === '0' || v === 0) return 0;
  throw new Error(`--threads must be true or false, got "${v}"`);
}

registerResource({
  name: 'wiring',
  plural: 'wirings',
  table: 'messaging_group_agents',
  description:
    'Wiring — connects a messaging group to an agent group. Determines which agent handles messages from which chat. The same messaging group can be wired to multiple agents; the same agent can be wired to multiple messaging groups.',
  idColumn: 'id',

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Run `ncl messaging-groups list` and copy the exact id
  2. If the group is gone, recreate it with `ncl messaging-groups create` then retry
  3. Verify you are connected to the right install (socket path / host)

Example fix

# before
ncl wirings delete --id abc123
# after (find real id first)
ncl messaging-groups list
ncl wirings delete --id <real-messaging-group-id>
Defensive patterns

Strategy: validation

Validate before calling

const mg = await getMessagingGroup(id);
if (!mg) throw new Error(`no such messaging group: ${id}`);

Prevention

When it happens

Trigger: ncl wirings create/update/delete --messaging-group-id <id> (or any command that resolves a wiring) where <id> is not a row in messaging_groups — mistyped id, deleted group, or wrong install/DB.

Common situations: Copy-pasting an id from another install, referencing a messaging group deleted after channel re-wiring, or running ncl against a different socket/data dir.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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