RocketChat/Rocket.Chat · error · Error

invalid-team

Error message

invalid-team

What it means

Error "invalid-team" thrown in RocketChat/Rocket.Chat.

Source

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

	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');
		}

		// validate access for every room first
		for await (const room of validRooms) {
			const canSeeRoom = await Authorization.canAccessRoom(room, user);

View on GitHub (pinned to e4b8178b20)

Solutions

  1. Verify the teamId refers to an existing team; look it up via teams.info or the Teams list before calling.
  2. Check that the team was not deleted between fetching its id and making the call.

When it happens

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