RocketChat/Rocket.Chat · error · Meteor.Error

error-invalid-asset

error-invalid-asset

Error message

Invalid asset

What it means

Error "Invalid asset" thrown in RocketChat/Rocket.Chat.

Source

Thrown at apps/meteor/server/lib/media/assets/assets.ts:233

	return assets[key as keyof IRocketChatAssets];
}

class RocketChatAssetsClass {
	get assets(): IRocketChatAssets {
		return assets;
	}

	public async setAssetWithBuffer(
		file: Buffer,
		contentType: string,
		asset: string,
	): Promise<{
		key: string;
		value: IRocketChatAsset;
	}> {
		const assetInstance = getAssetByKey(asset);
		if (!assetInstance) {
			throw new Meteor.Error('error-invalid-asset', 'Invalid asset', {
				function: 'RocketChat.Assets.setAsset',
			});
		}

		const extension = getExtension(contentType);
		if (assetInstance.constraints.extensions.includes(extension) === false) {
			throw new Meteor.Error('error-invalid-file-type', `Invalid file type: ${contentType}`, {
				function: 'RocketChat.Assets.setAsset',
			});
		}

		if (assetInstance.constraints.width || assetInstance.constraints.height) {
			const dimensions = sizeOf(file);
			if (assetInstance.constraints.width && assetInstance.constraints.width !== dimensions.width) {
				throw new Meteor.Error('error-invalid-file-width', 'Invalid file width', {
					function: 'Invalid file width',
				});
			}

View on GitHub (pinned to b2c16d5842)

Solutions

  1. Verify the asset key passed to RocketChat.Assets.setAsset is one of the registered assets (e.g. logo, favicon) before calling setAsset.
  2. Check the asset name for typos; getAssetByKey returned undefined for the given key.

When it happens

Trigger: Thrown at apps/meteor/server/lib/media/assets/assets.ts:233 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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