{"record":{"id":"41a9fcf256756bc9","repo":"nanocoai/nanoclaw","slug":"no-agent-group-ref-by-id-or-folder","errorCode":null,"errorMessage":"no agent group \"${ref}\" (by id or folder)","messagePattern":"no agent group \"(.+?)\" \\(by id or folder\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":195,"sourceCode":"          if (!channelType || !platformId) {\n            throw new Error('provide --messaging-group-id, or --channel-type and --platform-id to resolve it');\n          }\n          const mg = await getMessagingGroupByPlatform(\n            channelType,\n            platformId,\n            (args.instance as string) ?? channelType,\n          );\n          if (!mg) throw new Error(`no messaging group for ${channelType} ${platformId} — create it first`);\n          mgId = mg.id;\n        }\n\n        // Resolve the agent group (by id or by folder).\n        let agId = args.agent_group_id as string | undefined;\n        if (!agId) {\n          const ref = args.agent_group as string;\n          if (!ref) throw new Error('provide --agent-group-id or --agent-group <folder>');\n          const ag = (await getAgentGroup(ref)) ?? (await getAgentGroupByFolder(ref));\n          if (!ag) throw new Error(`no agent group \"${ref}\" (by id or folder)`);\n          agId = ag.id;\n        }\n\n        // Idempotent: a wiring for this pair already exists → return it\n        // (defaults/validation/side-effects are skipped — nothing new is written).\n        const existing = await getMessagingGroupAgentByPair(mgId, agId);\n        if (existing) return existing;\n\n        // Pass-1 parity: only defined keys enter `values` (an unset\n        // engage_pattern stays absent → column NULL), enums validated.\n        const values: Record<string, unknown> = {\n          id: randomUUID(),\n          messaging_group_id: mgId,\n          agent_group_id: agId,\n          created_at: new Date().toISOString(),\n        };\n        for (const [name, allowed] of Object.entries(CREATE_ENUMS)) {\n          const v = args[name];","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L177-L213","documentation":"The --agent-group reference was looked up both by id and by folder and neither matched an agent_groups row.","triggerScenarios":"ncl wirings create --agent-group <ref> where <ref> is neither a valid group id nor a group folder name.","commonSituations":"Typo in the folder name, group deleted, or using the display name instead of id/folder.","solutions":["Run `ncl groups list` and use the exact id or folder","If the group should exist, check you're on the right install/DB"],"exampleFix":"# before\nncl wirings create ... --agent-group my-agents\n# after\nncl groups list\nncl wirings create ... --agent-group my-agent-folder","handlingStrategy":"validation","validationCode":"const ag = (await getAgentGroup(ref)) ?? (await getAgentGroupByFolder(ref));\nif (!ag) throw new Error(`unknown agent group: ${ref}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use folder names verbatim from `ncl groups list`"],"tags":["cli","ncl","wiring","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}