ruvnet/ruflo · error · Error

msgType is required

Error message

msgType is required

What it means

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.

Solutions

  1. Pass a non-empty msgType from your type vocabulary, e.g. 'chat.message' or 'task.update'
  2. Check the exact key spelling 'msgType' (camelCase) in the input object
  3. Define your project's allowed msgType vocabulary up front and validate against it before calling

Example fix

// before — missing type
await callMCPTool('agentbbs_post', { roomId, payload: { text: 'ship it' } });

// after — type included
await callMCPTool('agentbbs_post', { roomId, msgType: 'chat.message', payload: { text: 'ship it' } });
Defensive patterns

Strategy: validation

Validate before calling

function requireMsgType(v: unknown): string {
  if (typeof v !== 'string' || v.length === 0) {
    throw new Error('msgType is required (e.g. "chat_message")');
  }
  return v;
}

Type guard

const isMsgType = (v: unknown): v is string => typeof v === 'string' && v.length > 0;

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of ruvnet/ruflo@9c61c86f06 (2026-08-18). Data as JSON: /api/errors/890a830311b5a863. Report an issue: GitHub.

Appendix: source

Thrown at v3/@claude-flow/cli/src/mcp-tools/agentbbs-tools.ts:398

          type: 'string',
          description: 'Typed event kind (pod-status / task-result / alert / human-override-ack / bench-result).',
        },
        payload: {
          type: 'object',
          description: 'Event-specific JSON-serializable payload.',
        },
        signature: {
          type: 'string',
          description: 'Optional Ed25519 signature over the canonical envelope bytes. Phase 1: pass-through.',
        },
      },
      required: ['roomId', 'msgType', 'payload'],
    },
    handler: async (input) => {
      const basePath = resolveBasePath(input.basePath as string | undefined);
      const roomId = validateRoomId(String(input.roomId));
      const msgType = String(input.msgType ?? '');
      if (!msgType) throw new Error('msgType is required');
      if (msgType.length > 64 || !/^[A-Za-z0-9_-]+$/.test(msgType)) {
        throw new Error('msgType must be alnum + _ - and ≤64 chars');
      }
      if (typeof input.payload !== 'object' || input.payload === null) {
        throw new Error('payload must be a JSON object');
      }

      if (!agentbbsCliAvailable()) return degradedResult('agentbbs-not-found');

      ensureDir(basePath);
      const logPath = roomLogPath(basePath, roomId);
      const base: BbsEnvelope = {
        envelopeId: base64url(randomBytes(12)),
        roomId,
        seq: nextSeq(logPath),
        msgType,
        payload: input.payload,
        timestamp: new Date().toISOString(),

View on GitHub (pinned to 9c61c86f06)