{"record":{"id":"dcb0ceec4fc6b2f3","repo":"nanocoai/nanoclaw","slug":"no-messaging-group-for-channeltype-platformid-dcb0ce","errorCode":null,"errorMessage":"no messaging group for ${channelType} ${platformId} — create it first","messagePattern":"no messaging group for (.+?) (.+?) — create it first","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":185,"sourceCode":"    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;\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","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L167-L203","documentation":"Wiring creation resolved channel_type/platform_id but getMessagingGroupByPlatform found no messaging_groups row for that combination. The wiring needs an existing messaging group; create it first.","triggerScenarios":"ncl wirings create --channel-type X --platform-id Y where no messaging group with that platform identity exists (e.g. the channel adapter hasn't received a message from that chat yet, or the group was never created).","commonSituations":"Wiring a brand-new channel chat before the host has seen a message from it, or a typo in the platform id.","solutions":["Create the messaging group first: `ncl messaging-groups create --channel-type X --platform-id Y` (then retry)","Double-check the platform id against the channel (channel/snowball id)","Alternatively send one message in the chat so the host registers it, then wire"],"exampleFix":"# before\nncl wirings create --channel-type slack --platform-id C999 --agent-group bot\n# after\nncl messaging-groups create --channel-type slack --platform-id C999 --is-group 1\nncl wirings create --channel-type slack --platform-id C999 --agent-group bot","handlingStrategy":"validation","validationCode":"const mg = await getMessagingGroupByPlatform(channelType, platformId, instance);\nif (!mg) await createMessagingGroup(channelType, platformId); // then wire","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create messaging groups before wiring them","Send one message in the chat so the host registers it, then wire"],"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"}