RocketChat/Rocket.Chat · error · Meteor.Error

error-room-archived

error-room-archived

Error message

The channel, ${room.name}, is archived

What it means

Thrown by findChannelByIdOrName when the caller passed checkedArchived: true and the resolved channel has archived set. The endpoint explicitly opts into archived-channel protection (most write operations like channels.join, channels.invite, channels.addAll use it), so modifying or joining an archived channel is rejected.

Solutions

  1. Unarchive first via POST /api/v1/channels.unarchive, then retry the original call
  2. Filter archived rooms out of batch jobs by checking the archived flag from channels.list before operating
  3. In user-facing flows, detect this error and show 'channel is archived' instead of retrying

Example fix

// before
POST /api/v1/channels.invite { roomId, userId } // error-room-archived

// after
await POST('/api/v1/channels.unarchive', { roomId });
await POST('/api/v1/channels.invite', { roomId, userId });
Defensive patterns

Strategy: try-catch

Validate before calling

const info = await GET('/api/v1/channels.info', { roomId });
if (info.channel.archived) {
  await POST('/api/v1/channels.unarchive', { roomId });
}

Type guard

const isArchived = (channel: { archived?: boolean }): boolean => Boolean(channel.archived);

Try / catch

try { /* channels.* write */ } catch (e) {
  if (e.error === 'error-room-archived') {
    await POST('/api/v1/channels.unarchive', { roomId });
    return retryOriginalCall();
  }
}

Prevention

When it happens

Trigger: Calling channels.invite, channels.join, channels.addAll, channels.setTopic, etc. (endpoints that pass checkedArchived) against a channel an admin archived earlier; unarchive race where the channel is re-archived between the UI load and the API call.

Common situations: Automation scripts iterate over stale channel lists that include archived rooms; admin archived the channel without announcing it; trying to post or add users to read-only historical channels.

Related errors


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

Appendix: source

Thrown at apps/meteor/server/api/v1/channels.ts:111

		  };
	userId?: string;
	checkedArchived?: boolean;
}): Promise<IRoom> {
	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 || (room.t !== 'c' && room.t !== 'l')) {
		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`);
	}
	if (userId && room.lastMessage) {
		const [lastMessage] = await normalizeMessagesForUser([room.lastMessage], userId);
		room.lastMessage = lastMessage;
	}

	return room;
}

const channelResponseSchema = ajv.compile<{ channel: IRoom }>({
	type: 'object',
	properties: {
		channel: { $ref: '#/components/schemas/IRoom' },
		success: { type: 'boolean', enum: [true] },
	},
	required: ['channel', 'success'],
	additionalProperties: false,
});

View on GitHub (pinned to e4b8178b20)