nanocoai/nanoclaw · error · Error

agent group not found: ${values.agent_group_id}

Error message

agent group not found: ${values.agent_group_id}

What it means

During wiring creation, if engage_mode was not supplied and the channel has declared defaults, the CLI loads the agent group to resolve defaults (it needs the agent name for mention patterns); a missing agent group row throws here.

Source

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

          }
          values[name] = v;
        }
        if (args.engage_pattern !== undefined) values.engage_pattern = args.engage_pattern;
        if (args.threads !== undefined) values.threads = args.threads;
        if (args.priority !== undefined) values.priority = Number(args.priority);

        // Pass-2 parity: context-aware defaults + cross-column validation.
        const mg = await requireMessagingGroup(values.messaging_group_id);
        if (values.threads !== undefined) values.threads = normalizeThreads(values.threads);

        const channelKey = mg.instance ?? mg.channel_type;
        // Undeclared (stale) channels: leave engage_mode unset so the static
        // 'mention' default applies afterwards — a trunk update alone must not
        // change ncl's creation defaults for adapters without a declaration.
        if (values.engage_mode === undefined) {
          if (hasDeclaredChannelDefaults(channelKey, mg.channel_type)) {
            const ag = await getAgentGroup(String(values.agent_group_id));
            if (!ag) throw new Error(`agent group not found: ${values.agent_group_id}`);
            const resolved = resolveWiringDefaults(channelKey, mg.is_group === 1, ag.name, mg.channel_type);
            values.engage_mode = resolved.engage_mode;
            if (values.engage_pattern === undefined && resolved.engage_pattern !== null) {
              values.engage_pattern = resolved.engage_pattern;
            }
          } else {
            log.warn(
              `wiring create: channel '${channelKey}' has no declared defaults (adapter not installed or stale) — using legacy static defaults`,
            );
          }
        }
        // May mutate values.engage_mode (mention-sticky→mention coercion) —
        // must run after declaration resolution and threads normalization.
        validateEngageAgainstChannel(values, mg);

        // Pass-3 parity: static defaults for whatever is still unset. threads
        // is intentionally left absent when omitted — column NULL = inherit
        // the channel declaration.

View on GitHub (pinned to 294ef2aee8)

Solutions

  1. Re-run `ncl groups list` and confirm the id exists
  2. Recreate the agent group if it was deleted, then retry the wiring
  3. Pass an explicit --engage-mode to skip default resolution (still needs a valid group)
Defensive patterns

Strategy: try-catch

Validate before calling

const ag = await getAgentGroup(agId);
if (!ag) throw new Error('agent group vanished; re-check `ncl groups list`');

Try / catch

try { await createWiring(args); } catch (e) { if (/agent group not found/.test(String(e))) { /* re-resolve and retry once */ } throw e; }

Prevention

When it happens

Trigger: ncl wirings create with a valid-looking agent_group_id that has no agent_groups row (e.g. the group was deleted between resolution and default resolution, or an id was hand-crafted).

Common situations: Race with a concurrent `ncl groups delete`, or referencing an agent group from another install.

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