RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-file-width
error-invalid-file-width
Error message
Invalid file width
What it means
Error "Invalid file width" thrown in RocketChat/Rocket.Chat.
Source
Thrown at apps/meteor/server/lib/media/assets/assets.ts:248
}> {
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',
});
}
if (assetInstance.constraints.height && assetInstance.constraints.height !== dimensions.height) {
throw new Meteor.Error('error-invalid-file-height');
}
}
const rs = RocketChatFile.bufferToStream(file);
await RocketChatAssetsInstance.deleteFile(asset);
const ws = RocketChatAssetsInstance.createWriteStream(asset, contentType);
return new Promise((resolve) => {
ws.on('end', () => {
return setTimeout(async () => {
const key = `Assets_${asset}`;
const value = {View on GitHub (pinned to b2c16d5842)
Solutions
- Resize the image so its width exactly matches the width required by the asset's constraints before uploading.
- Check the asset definition for the expected width and supply an image of that size.
When it happens
Trigger: Thrown at apps/meteor/server/lib/media/assets/assets.ts:248 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/b02b60d6eca9ac5d.
Report an issue: GitHub.