{"record":{"id":"2d0d84822e470e50","repo":"nanocoai/nanoclaw","slug":"provide-messaging-group-id-or-channel-type-an","errorCode":null,"errorMessage":"provide --messaging-group-id, or --channel-type and --platform-id to resolve it","messagePattern":"provide --messaging-group-id, or --channel-type and --platform-id to resolve it","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":178,"sourceCode":"    validateEngageAgainstChannel(merged, mg);\n    // Carry the sticky→mention coercion (if any) back into the update set.\n    if (merged.engage_mode !== (updates.engage_mode ?? current.engage_mode)) {\n      updates.engage_mode = merged.engage_mode;\n    }\n  },\n  customOperations: {\n    create: {\n      access: 'approval',\n      description:\n        'Wire a messaging group to an agent group. Identify the messaging group by --messaging-group-id OR --channel-type + --platform-id (+ --instance); identify the agent by --agent-group-id OR --agent-group <folder>. Idempotent on (messaging group, agent group). Engagement flags: --engage-mode, --engage-pattern, --session-mode, --sender-scope, --ignored-message-policy, --threads, --priority. Omitted engage flags default from the channel adapter declaration.',\n      handler: async (args) => {\n        // Resolve the messaging group.\n        let mgId = args.messaging_group_id as string | undefined;\n        if (!mgId) {\n          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;","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L160-L196","documentation":"When creating a wiring, if --messaging-group-id is absent the CLI tries to resolve the group from --channel-type + --platform-id; if either is missing too, it throws this.","triggerScenarios":"ncl wirings create with neither --messaging-group-id nor both --channel-type and --platform-id.","commonSituations":"Assuming the channel is implied by the agent group, or providing only --channel-type without the platform id.","solutions":["Pass --messaging-group-id directly (get it from `ncl messaging-groups list`)","Or pass both --channel-type <type> and --platform-id <id> (plus optional --instance)"],"exampleFix":"# before\nncl wirings create --agent-group myagent --channel-type discord\n# after\nncl wirings create --agent-group myagent --channel-type discord --platform-id 123456789","handlingStrategy":"validation","validationCode":"if (!mgId && !(channelType && platformId)) {\n  throw new Error('need --messaging-group-id or --channel-type + --platform-id');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap ncl wirings create in a script that checks required flags first"],"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"}