RocketChat/Rocket.Chat · error · Meteor.Error
The required "mid" body param is missing.
Error message
The required "mid" body param is missing.
What it means
Thrown by POST chat.followMessage (apps/meteor/server/api/v1/chat.ts:481) when this.bodyParams.mid is falsy before calling followMessage. Note it is a Meteor.Error with no error code - only the message text. On current servers the body schema (isChatFollowMessageLocalProps, requires mid with minLength 1) rejects a missing/empty mid first with a schema 400, so this throw is a legacy/defense-in-depth guard that mainly surfaces on older builds or when validation is bypassed.
Solutions
- Always send { "mid": "<message id>" } in the body - mid is required and must be non-empty.
- Upgrade the server so missing params fail fast in schema validation with a clear 400 instead of reaching the handler.
- If you maintain a client, validate the payload against the published ChatFollowMessage schema (mid: string, minLength 1) before sending.
- On the client, treat both this message and 'Body does not match schema' as the same class: caller forgot mid.
Example fix
// before
await rc.post('/api/v1/chat.followMessage', { }); // 400: mid required
// after
await rc.post('/api/v1/chat.followMessage', { mid: messageId }); Defensive patterns
Strategy: validation
Validate before calling
const isFollowPayload = (p: { mid?: unknown }): p is { mid: string } =>
typeof p.mid === 'string' && p.mid.length > 0;
if (!isFollowPayload(payload)) throw new Error('mid is required');
await rc.post('/api/v1/chat.followMessage', payload); Type guard
const isFollowPayload = (p: { mid?: unknown }): p is { mid: string } =>
typeof p.mid === 'string' && p.mid.length > 0; Try / catch
try {
await rc.post('/api/v1/chat.followMessage', { mid });
} catch (e) {
if (/"mid" body param is missing/i.test(e?.error ?? '') || e?.errorType === 'error-invalid-params') fixPayload();
else throw e;
} Prevention
- Type the request body and validate mid (non-empty string) before sending.
- mid is the thread's main message id - capture it when the follow action starts so unfollow can reuse it.
When it happens
Trigger: POST /api/v1/chat.followMessage with body lacking mid, with mid: "" or mid: null. On modern servers you usually get 'Body does not match schema' (400) instead; this exact message appears on servers predating body validation on this endpoint or when mid is explicitly undefined in crafted payloads.
Common situations: Integrations written against old Rocket.Chat versions (pre-schema-validation) re-surfacing after upgrades in reverse; JSON bodies built dynamically where mid is conditionally omitted; tests sending {} to probe validation behavior.
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
- error-emoji-param-not-provided
- error-invalid-message
- error-not-allowed
- error-param-required
- error-room-does-not-exist
AI-assisted analysis of RocketChat/Rocket.Chat@e4b8178b20 (2026-08-18).
Data as JSON: /api/errors/a2dcba76572c2b2b.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/chat.ts:485
401: validateUnauthorizedErrorResponse,
200: ajv.compile<void>({
type: 'object',
properties: {
success: {
type: 'boolean',
enum: [true],
},
},
required: ['success'],
additionalProperties: false,
}),
},
},
async function action() {
const { mid } = this.bodyParams;
if (!mid) {
throw new Meteor.Error('The required "mid" body param is missing.');
}
await followMessage(this.user, { mid });
return API.v1.success();
},
)
.post(
'chat.unfollowMessage',
{
authRequired: true,
body: isChatUnfollowMessageLocalProps,
response: {
400: validateBadRequestErrorResponse,
401: validateUnauthorizedErrorResponse,
200: ajv.compile<void>({
type: 'object',
properties: {View on GitHub (pinned to e4b8178b20)