{"record":{"id":"890a830311b5a863","repo":"ruvnet/ruflo","slug":"msgtype-is-required","errorCode":null,"errorMessage":"msgType is required","messagePattern":"msgType is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts","lineNumber":398,"sourceCode":"          type: 'string',\n          description: 'Typed event kind (pod-status / task-result / alert / human-override-ack / bench-result).',\n        },\n        payload: {\n          type: 'object',\n          description: 'Event-specific JSON-serializable payload.',\n        },\n        signature: {\n          type: 'string',\n          description: 'Optional Ed25519 signature over the canonical envelope bytes. Phase 1: pass-through.',\n        },\n      },\n      required: ['roomId', 'msgType', 'payload'],\n    },\n    handler: async (input) => {\n      const basePath = resolveBasePath(input.basePath as string | undefined);\n      const roomId = validateRoomId(String(input.roomId));\n      const msgType = String(input.msgType ?? '');\n      if (!msgType) throw new Error('msgType is required');\n      if (msgType.length > 64 || !/^[A-Za-z0-9_-]+$/.test(msgType)) {\n        throw new Error('msgType must be alnum + _ - and ≤64 chars');\n      }\n      if (typeof input.payload !== 'object' || input.payload === null) {\n        throw new Error('payload must be a JSON object');\n      }\n\n      if (!agentbbsCliAvailable()) return degradedResult('agentbbs-not-found');\n\n      ensureDir(basePath);\n      const logPath = roomLogPath(basePath, roomId);\n      const base: BbsEnvelope = {\n        envelopeId: base64url(randomBytes(12)),\n        roomId,\n        seq: nextSeq(logPath),\n        msgType,\n        payload: input.payload,\n        timestamp: new Date().toISOString(),","sourceCodeStart":380,"sourceCodeEnd":416,"githubUrl":"https://github.com/ruvnet/ruflo/blob/9c61c86f06b439af2a95085ae9bb0ca839662e41/v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts#L380-L416","documentation":"In the agentbbs post-message handler, input.msgType is coerced via String(input.msgType ?? ''); if the result is empty the handler throws 'msgType is required' before format validation. msgType is the envelope's semantic type (e.g. 'chat.message') and is a required member of the tool schema alongside roomId and payload.","triggerScenarios":"Posting an envelope with msgType omitted, set to '' or null; a typo'd key ('msgtype', 'type') so the real value lands in an ignored field; LLM-composed calls dropping the field because the payload looked complete.","commonSituations":"Schema-loose callers (plain objects from JSON files) that omit required fields; refactors renaming the field; tests that construct minimal payloads and forget the type.","solutions":["Pass a non-empty msgType from your type vocabulary, e.g. 'chat.message' or 'task.update'","Check the exact key spelling 'msgType' (camelCase) in the input object","Define your project's allowed msgType vocabulary up front and validate against it before calling"],"exampleFix":"// before — missing type\nawait callMCPTool('agentbbs_post', { roomId, payload: { text: 'ship it' } });\n\n// after — type included\nawait callMCPTool('agentbbs_post', { roomId, msgType: 'chat.message', payload: { text: 'ship it' } });","handlingStrategy":"validation","validationCode":"function requireMsgType(v: unknown): string {\n  if (typeof v !== 'string' || v.length === 0) {\n    throw new Error('msgType is required (e.g. \"chat_message\")');\n  }\n  return v;\n}","typeGuard":"const isMsgType = (v: unknown): v is string => typeof v === 'string' && v.length > 0;","tryCatchPattern":null,"preventionTips":["Define a closed vocabulary of msgTypes in your project and validate against it","Type tool inputs (zod/ts) so missing required fields fail early","Use the exact key 'msgType'"],"tags":["validation","agentbbs","required-parameter","messaging"],"backgroundTag":"missing-required-argument","analyzedSha":"9c61c86f06b439af2a95085ae9bb0ca839662e41","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}