RocketChat/Rocket.Chat · error · Meteor.Error
error-roomid-param-not-provided
error-roomid-param-not-provided
Error message
The parameter "roomId" is required
What it means
dmMessagesOthersAction reads roomId from this.queryParams and throws error-roomid-param-not-provided when missing. Note the distinct error code 'error-roomid-param-not-provided' (with the 'id' segment) used only here, vs 'error-room-param-not-provided' used elsewhere.
Source
Thrown at apps/meteor/server/api/v1/im.ts:799
response: {
200: paginatedMessagesResponseSchema,
400: validateBadRequestErrorResponse,
401: validateUnauthorizedErrorResponse,
403: validateForbiddenErrorResponse,
},
};
const dmMessagesOthersAction = <Path extends string>(_name: Path): TypedAction<typeof dmMessagesOthersEndpointsProps, Path> =>
async function action() {
if (settings.get('API_Enable_Direct_Message_History_EndPoint') !== true) {
throw new Meteor.Error('error-endpoint-disabled', 'This endpoint is disabled', {
route: '/api/v1/im.messages.others',
});
}
const { roomId } = this.queryParams;
if (!roomId) {
throw new Meteor.Error('error-roomid-param-not-provided', 'The parameter "roomId" is required');
}
const room = await Rooms.findOneById<Pick<IRoom, '_id' | 't'>>(roomId, { projection: { _id: 1, t: 1 } });
if (!room || room?.t !== 'd') {
throw new Meteor.Error('error-room-not-found', `No direct message room found by the id of: ${roomId}`);
}
const { offset, count } = await getPaginationItems(this.queryParams);
const { sort, fields, query } = await this.parseJsonQuery();
const ourQuery = Object.assign({}, query, { rid: room._id });
const { cursor, totalCount } = Messages.findPaginated<IMessage>(ourQuery, {
sort: sort || { ts: -1 },
skip: offset,
limit: count,
projection: fields,
});
View on GitHub (pinned to f9d3ec372b)
Solutions
- Append roomId to the query string: GET /api/v1/im.messages.others?roomId=<rid>.
- Use the exact key 'roomId'.
- Confirm the value is non-empty.
Example fix
// before GET /api/v1/im.messages.others // after GET /api/v1/im.messages.others?roomId=<rid>
Defensive patterns
Strategy: validation
Validate before calling
function buildMessagesOthersQuery(roomId) {
if (!roomId) throw new TypeError('roomId query param is required');
return { roomId };
}
await api.get('/api/v1/im.messages.others', { params: buildMessagesOthersQuery(roomId) }); Type guard
function hasRoomIdQueryParam(q: unknown): q is { roomId: string } {
return typeof (q as any)?.roomId === 'string' && (q as any).roomId.length > 0;
} Prevention
- im.messages.others takes roomId from the query string.
- Watch the distinct error code 'error-roomid-param-not-provided'.
- Reject empty roomId before sending.
When it happens
Trigger: GET /api/v1/im.messages.others without a roomId query parameter or with roomId sent in the body.
Common situations: Client omits roomId; passes a wrong key; passes only count/offset.
Related errors
- error-room-not-found
- error-invalid-room
- Invalid Api parameter provided, it must be a valid IApi obje
- error-emoji-param-not-provided
- error-param-required
AI-assisted analysis of RocketChat/Rocket.Chat@f9d3ec372b (2026-08-12).
Data as JSON: /api/errors/d8a70f3efe558b78.
Report an issue: GitHub.