RocketChat/Rocket.Chat · error · Error

missing-userId

Error message

missing-userId

What it means

Error "missing-userId" thrown in RocketChat/Rocket.Chat.

Source

Thrown at apps/meteor/server/services/team/service.ts:321

		if (options === undefined) {
			return Team.findByNames(names).toArray();
		}
		return Team.findByNames(names, options).toArray();
	}

	async listByIds(ids: Array<string>, options?: FindOptions<ITeam>): Promise<ITeam[]> {
		return Team.findByIds(ids, options).toArray();
	}

	async addRooms(uid: string, rooms: Array<string>, teamId: string): Promise<Array<IRoom>> {
		if (!teamId) {
			throw new Error('missing-teamId');
		}
		if (!rooms) {
			throw new Error('missing-rooms');
		}
		if (!uid) {
			throw new Error('missing-userId');
		}

		const team = await Team.findOneById<Pick<ITeam, '_id' | 'roomId'>>(teamId, { projection: { _id: 1, roomId: 1 } });
		if (!team) {
			throw new Error('invalid-team');
		}

		// at this point, we already checked for the permission
		// so we just need to check if the user can see the room
		const user = await Users.findOneById(uid);
		if (!user) {
			throw new Error('invalid-user');
		}

		const rids = rooms.filter((rid) => rid && typeof rid === 'string');
		const validRooms = await Rooms.findManyByRoomIds(rids).toArray();
		if (validRooms.length < rids.length) {
			throw new Error('invalid-room');

View on GitHub (pinned to e4b8178b20)

Solutions

  1. Ensure the caller is authenticated so a valid user id (uid) is passed to the team service.
  2. Verify the session token is valid and has not expired before calling addRooms or removeRoom.

When it happens

Trigger: Thrown at apps/meteor/server/services/team/service.ts:319 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RocketChat/Rocket.Chat@e4b8178b20 (2026-08-18). Data as JSON: /api/errors/401da4c724330134. Report an issue: GitHub.