RocketChat/Rocket.Chat · error · Meteor.Error
error-roomid-param-not-provided
error-roomid-param-not-provided
Error message
The parameter "roomId" or "roomName" is required
What it means
Thrown by the shared findRoomByIdOrName helper (used by rooms.info and sibling endpoints) when the request provides neither roomId nor roomName, or provides both keys with both values empty/falsy. Exactly one non-empty identifier is required; this check runs before any database lookup, so it is purely a request-shape error.
Solutions
- Pass exactly one non-empty identifier: ?roomId=<_id> or ?roomName=<name>
- Guard the query builder so the request is never sent with both identifiers empty
- Check the parameter spelling against the endpoint schema (roomId, not rid or channelId)
- Log the outgoing query string when debugging to spot empty values
Example fix
// before
await sdk.get('rooms.info', {}); // no identifier at all
// after
if (!roomId && !roomName) throw new Error('roomId or roomName is required');
await sdk.get('rooms.info', roomId ? { roomId } : { roomName }); Defensive patterns
Strategy: type-guard
Validate before calling
const hasTarget = (p: { roomId?: string; roomName?: string }) => Boolean(p.roomId?.trim() || p.roomName?.trim());
if (!hasTarget(query)) throw new Error('roomId or roomName is required'); Type guard
type RoomTarget = { roomId: string } | { roomName: string };
function isRoomTarget(p: { roomId?: string; roomName?: string }): p is RoomTarget {
return Boolean(p.roomId?.trim() || p.roomName?.trim());
} Try / catch
try {
await sdk.get('rooms.info', query);
} catch (e: any) {
if (e?.response?.data?.errorType === 'error-roomid-param-not-provided') {
throw new Error('caller bug: no roomId/roomName attached');
}
throw e;
} Prevention
- Type the request builder so exactly one of roomId/roomName is required
- Assert non-empty identifiers at the API-client boundary
- Log outgoing query strings in debug builds to catch empty values
When it happens
Trigger: GET /api/v1/rooms.info with an empty query string; sending a parameter named rid or channelId instead of roomId/roomName; sending { roomId: '', roomName: '' } where the second clause of the condition (both keys present, both falsy) trips.
Common situations: Client code reading the id from an undefined variable and interpolating it into the query; parameter renamed during API migrations; copy-pasted curl commands with the value deleted; form submissions where both optional fields were left blank.
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-invalid-param
- error-param-not-provided
- error-roomId-param-invalid
- error-roomid-param-not-provided
- error-updatedSince-param-invalid
AI-assisted analysis of RocketChat/Rocket.Chat@e4b8178b20 (2026-08-18).
Data as JSON: /api/errors/6da07533c96acd09.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/api/v1/rooms.ts:118
export async function findRoomByIdOrName({
params,
checkedArchived = true,
}: {
params:
| {
roomId?: string;
}
| {
roomName?: string;
};
checkedArchived?: boolean;
}): Promise<IRoom> {
if (
(!('roomId' in params) && !('roomName' in params)) ||
('roomId' in params && !(params as { roomId?: string }).roomId && 'roomName' in params && !(params as { roomName?: string }).roomName)
) {
throw new Meteor.Error('error-roomid-param-not-provided', 'The parameter "roomId" or "roomName" is required');
}
const projection = { ...API.v1.defaultFieldsToExclude };
let room;
if ('roomId' in params) {
room = await Rooms.findOneById(params.roomId || '', { projection });
} else if ('roomName' in params) {
room = await Rooms.findOneByName(params.roomName || '', { projection });
}
if (!room) {
throw new Meteor.Error('error-room-not-found', 'The required "roomId" or "roomName" param provided does not match any channel');
}
if (checkedArchived && room.archived) {
throw new Meteor.Error('error-room-archived', `The channel, ${room.name}, is archived`);
}
View on GitHub (pinned to e4b8178b20)