nanocoai/nanoclaw · error · Error

no agent group "${ref}" (by id or folder)

Error message

no agent group "${ref}" (by id or folder)

What it means

The --agent-group reference was looked up both by id and by folder and neither matched an agent_groups row.

Source

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

          if (!channelType || !platformId) {
            throw new Error('provide --messaging-group-id, or --channel-type and --platform-id to resolve it');
          }
          const mg = await getMessagingGroupByPlatform(
            channelType,
            platformId,
            (args.instance as string) ?? channelType,
          );
          if (!mg) throw new Error(`no messaging group for ${channelType} ${platformId} — create it first`);
          mgId = mg.id;
        }

        // Resolve the agent group (by id or by folder).
        let agId = args.agent_group_id as string | undefined;
        if (!agId) {
          const ref = args.agent_group as string;
          if (!ref) throw new Error('provide --agent-group-id or --agent-group <folder>');
          const ag = (await getAgentGroup(ref)) ?? (await getAgentGroupByFolder(ref));
          if (!ag) throw new Error(`no agent group "${ref}" (by id or folder)`);
          agId = ag.id;
        }

        // Idempotent: a wiring for this pair already exists → return it
        // (defaults/validation/side-effects are skipped — nothing new is written).
        const existing = await getMessagingGroupAgentByPair(mgId, agId);
        if (existing) return existing;

        // Pass-1 parity: only defined keys enter `values` (an unset
        // engage_pattern stays absent → column NULL), enums validated.
        const values: Record<string, unknown> = {
          id: randomUUID(),
          messaging_group_id: mgId,
          agent_group_id: agId,
          created_at: new Date().toISOString(),
        };
        for (const [name, allowed] of Object.entries(CREATE_ENUMS)) {
          const v = args[name];

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Run `ncl groups list` and use the exact id or folder
  2. If the group should exist, check you're on the right install/DB

Example fix

# before
ncl wirings create ... --agent-group my-agents
# after
ncl groups list
ncl wirings create ... --agent-group my-agent-folder
Defensive patterns

Strategy: validation

Validate before calling

const ag = (await getAgentGroup(ref)) ?? (await getAgentGroupByFolder(ref));
if (!ag) throw new Error(`unknown agent group: ${ref}`);

Prevention

When it happens

Trigger: ncl wirings create --agent-group <ref> where <ref> is neither a valid group id nor a group folder name.

Common situations: Typo in the folder name, group deleted, or using the display name instead of id/folder.

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/41a9fcf256756bc9. Report an issue: GitHub.