{"record":{"id":"1c4ecd26cb24b922","repo":"nanocoai/nanoclaw","slug":"name-must-be-one-of-allowed-join","errorCode":null,"errorMessage":"${name} must be one of: ${allowed.join(', ')}","messagePattern":"(.+?) must be one of: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/wirings.ts","lineNumber":216,"sourceCode":"\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];\n          if (v === undefined) continue;\n          if (!allowed.includes(String(v))) {\n            throw new Error(`${name} must be one of: ${allowed.join(', ')}`);\n          }\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));","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/wirings.ts#L198-L234","documentation":"Wiring creation validates enum columns (CREATE_ENUMS: ignored_message_policy drop|accumulate, session_mode shared|per-thread|agent-shared) and throws listing the allowed values when a supplied value is not in the set.","triggerScenarios":"ncl wirings create --session-mode group or --ignored-message-policy skip — any value outside the declared enums.","commonSituations":"Guessing enum spellings ('isolate' for session_mode, 'ignore' for ignored_message_policy) or stale docs from an older version with different values.","solutions":["Use an allowed value from the message: session_mode = shared|per-thread|agent-shared; ignored_message_policy = drop|accumulate","Check `ncl wirings help` for current options"],"exampleFix":"# before\nncl wirings create ... --session-mode group\n# after\nncl wirings create ... --session-mode agent-shared","handlingStrategy":"validation","validationCode":"const ENUMS = { ignored_message_policy:['drop','accumulate'], session_mode:['shared','per-thread','agent-shared'] };\nfor (const [k, allowed] of Object.entries(ENUMS)) {\n  if (v[k] !== undefined && !allowed.includes(String(v[k]))) throw new Error(`${k} must be one of: ${allowed.join(', ')}`);\n}","typeGuard":"function isValidWiringEnum(k: string, v: string): boolean {\n  const allowed: Record<string,string[]> = {\n    ignored_message_policy: ['drop','accumulate'],\n    session_mode: ['shared','per-thread','agent-shared'],\n  };\n  return !allowed[k] || allowed[k].includes(v);\n}","tryCatchPattern":null,"preventionTips":["Copy enum values from `ncl wirings help`, not memory"],"tags":["cli","ncl","enum-validation","wiring"],"backgroundTag":"invalid-enum-value","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}