{"record":{"id":"890a830311b5a863","repo":"ruvnet/ruflo","slug":"msgtype-is-required","errorCode":null,"errorMessage":"msgType is required","messagePattern":"msgType is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts","lineNumber":275,"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      const api = await loadAgentbbs();\n      if (!api) return degradedResult('agentbbs-not-found');\n\n      ensureDir(basePath);\n      const logPath = roomLogPath(basePath, roomId);\n      const env: BbsEnvelope = {\n        envelopeId: base64url(randomBytes(12)),\n        roomId,\n        seq: nextSeq(logPath),\n        msgType,\n        payload: input.payload,","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts#L257-L293","documentation":"Thrown by the federation_bbs_publish handler when msgType coerces to an empty string (input.msgType is undefined, null, '', or missing). msgType is the typed event kind that the cockpit and other pods dispatch on (pod-status / task-result / alert / human-override-ack / bench-result), so an empty value is rejected before envelope construction.","triggerScenarios":"Calling federation_bbs_publish without msgType; passing an empty string; passing a value whose String() coercion is empty; field name typo (`type` instead of `msgType`).","commonSituations":"Event pipeline that conditionally sets msgType and hit the missing branch; schema mismatch between producer and the tool's expected field; a fixture copied without the msgType line.","solutions":["Always supply msgType as one of the documented kinds (e.g. 'pod-status').","Validate at your boundary that msgType is a non-empty string before invoking the tool.","If msgType is dynamic, restrict it to a known enum in your caller."],"exampleFix":"// before\nfederation_bbs_publish({ roomId, payload }); // throws: msgType is required\n// after\nfederation_bbs_publish({ roomId, msgType: 'alert', payload });","handlingStrategy":"validation","validationCode":"const MSG_TYPES = new Set(['pod-status','task-result','alert','human-override-ack','bench-result']);\nfunction requireMsgType(t: unknown): string {\n  if (typeof t !== 'string' || t.length === 0) throw new Error('msgType required');\n  return t;\n}","typeGuard":"const isMsgType = (v: unknown): v is string => typeof v === 'string' && v.length > 0 && v.length <= 64 && /^[A-Za-z0-9_-]+$/.test(v);","tryCatchPattern":"null","preventionTips":["Restrict msgType to a known enum at your boundary.","Map display names to canonical short identifiers before publish.","Add a schema test that every published type matches the regex."],"tags":["validation","agentbbs","federation","required-field"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}