{"record":{"id":"e554301aadeb3421","repo":"nanocoai/nanoclaw","slug":"provide-agent-group-id-or-agent-group-folder","errorCode":null,"errorMessage":"provide --agent-group-id or --agent-group <folder>","messagePattern":"provide --agent-group-id or --agent-group <folder>","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":193,"sourceCode":"          const channelType = args.channel_type as string;\n          const platformId = args.platform_id as string;\n          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        };","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L175-L211","documentation":"Wiring creation requires an agent group, resolved either by --agent-group-id or by --agent-group <folder-or-name>; if neither is given it throws.","triggerScenarios":"ncl wirings create with only messaging-group arguments and no agent group reference.","commonSituations":"Forgetting the agent side of the wiring, or assuming a default agent group exists.","solutions":["Add --agent-group <folder> (or --agent-group-id <id>)","List candidates with `ncl groups list`"],"exampleFix":"# before\nncl wirings create --channel-type discord --platform-id 123\n# after\nncl wirings create --channel-type discord --platform-id 123 --agent-group myagent","handlingStrategy":"validation","validationCode":"if (!agId && !agentGroupRef) throw new Error('need --agent-group-id or --agent-group');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit agent group when scripting wiring creation"],"tags":["cli","ncl","wiring","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}