RocketChat/Rocket.Chat · error · Error

missing-teamId

Error message

missing-teamId

What it means

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

Source

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

	listByNames<P extends Document>(names: Array<string>, options: FindOptions<P extends ITeam ? ITeam : P>): Promise<P[]>;

	async listByNames<P extends Document>(
		names: Array<string>,
		options?: FindOptions<ITeam> | FindOptions<P extends ITeam ? ITeam : P>,
	): Promise<P[] | ITeam[]> {
		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');

View on GitHub (pinned to e4b8178b20)

Solutions

  1. Pass a valid teamId when calling the addRooms endpoint or TeamService.addRooms.
  2. Verify the client request body includes the teamId field before submitting.

When it happens

Trigger: Thrown at apps/meteor/server/services/team/service.ts:313 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/8fc921053e1445f2. Report an issue: GitHub.