{"record":{"id":"bdfe36f3159556d3","repo":"nanocoai/nanoclaw","slug":"agent-group-not-found-values-agent-group-id","errorCode":null,"errorMessage":"agent group not found: ${values.agent_group_id}","messagePattern":"agent group not found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":235,"sourceCode":"          }\n          values[name] = v;\n        }\n        if (args.engage_pattern !== undefined) values.engage_pattern = args.engage_pattern;\n        if (args.threads !== undefined) values.threads = args.threads;\n        if (args.priority !== undefined) values.priority = Number(args.priority);\n\n        // Pass-2 parity: context-aware defaults + cross-column validation.\n        const mg = await requireMessagingGroup(values.messaging_group_id);\n        if (values.threads !== undefined) values.threads = normalizeThreads(values.threads);\n\n        const channelKey = mg.instance ?? mg.channel_type;\n        // Undeclared (stale) channels: leave engage_mode unset so the static\n        // 'mention' default applies afterwards — a trunk update alone must not\n        // change ncl's creation defaults for adapters without a declaration.\n        if (values.engage_mode === undefined) {\n          if (hasDeclaredChannelDefaults(channelKey, mg.channel_type)) {\n            const ag = await getAgentGroup(String(values.agent_group_id));\n            if (!ag) throw new Error(`agent group not found: ${values.agent_group_id}`);\n            const resolved = resolveWiringDefaults(channelKey, mg.is_group === 1, ag.name, mg.channel_type);\n            values.engage_mode = resolved.engage_mode;\n            if (values.engage_pattern === undefined && resolved.engage_pattern !== null) {\n              values.engage_pattern = resolved.engage_pattern;\n            }\n          } else {\n            log.warn(\n              `wiring create: channel '${channelKey}' has no declared defaults (adapter not installed or stale) — using legacy static defaults`,\n            );\n          }\n        }\n        // May mutate values.engage_mode (mention-sticky→mention coercion) —\n        // must run after declaration resolution and threads normalization.\n        validateEngageAgainstChannel(values, mg);\n\n        // Pass-3 parity: static defaults for whatever is still unset. threads\n        // is intentionally left absent when omitted — column NULL = inherit\n        // the channel declaration.","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L217-L253","documentation":"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.","triggerScenarios":"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).","commonSituations":"Race with a concurrent `ncl groups delete`, or referencing an agent group from another install.","solutions":["Re-run `ncl groups list` and confirm the id exists","Recreate the agent group if it was deleted, then retry the wiring","Pass an explicit --engage-mode to skip default resolution (still needs a valid group)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const ag = await getAgentGroup(agId);\nif (!ag) throw new Error('agent group vanished; re-check `ncl groups list`');","typeGuard":null,"tryCatchPattern":"try { await createWiring(args); } catch (e) { if (/agent group not found/.test(String(e))) { /* re-resolve and retry once */ } throw e; }","preventionTips":["Avoid deleting agent groups while wiring scripts run"],"tags":["cli","ncl","wiring","not-found","race-condition"],"backgroundTag":"entity-not-found","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}