{"record":{"id":"b02b60d6eca9ac5d","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-file-width","errorCode":"error-invalid-file-width","errorMessage":"Invalid file width","messagePattern":"Invalid file width","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/media/assets/assets.ts","lineNumber":248,"sourceCode":"\t}> {\n\t\tconst assetInstance = getAssetByKey(asset);\n\t\tif (!assetInstance) {\n\t\t\tthrow new Meteor.Error('error-invalid-asset', 'Invalid asset', {\n\t\t\t\tfunction: 'RocketChat.Assets.setAsset',\n\t\t\t});\n\t\t}\n\n\t\tconst extension = getExtension(contentType);\n\t\tif (assetInstance.constraints.extensions.includes(extension) === false) {\n\t\t\tthrow new Meteor.Error('error-invalid-file-type', `Invalid file type: ${contentType}`, {\n\t\t\t\tfunction: 'RocketChat.Assets.setAsset',\n\t\t\t});\n\t\t}\n\n\t\tif (assetInstance.constraints.width || assetInstance.constraints.height) {\n\t\t\tconst dimensions = sizeOf(file);\n\t\t\tif (assetInstance.constraints.width && assetInstance.constraints.width !== dimensions.width) {\n\t\t\t\tthrow new Meteor.Error('error-invalid-file-width', 'Invalid file width', {\n\t\t\t\t\tfunction: 'Invalid file width',\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (assetInstance.constraints.height && assetInstance.constraints.height !== dimensions.height) {\n\t\t\t\tthrow new Meteor.Error('error-invalid-file-height');\n\t\t\t}\n\t\t}\n\n\t\tconst rs = RocketChatFile.bufferToStream(file);\n\t\tawait RocketChatAssetsInstance.deleteFile(asset);\n\n\t\tconst ws = RocketChatAssetsInstance.createWriteStream(asset, contentType);\n\n\t\treturn new Promise((resolve) => {\n\t\t\tws.on('end', () => {\n\t\t\t\treturn setTimeout(async () => {\n\t\t\t\t\tconst key = `Assets_${asset}`;\n\t\t\t\t\tconst value = {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/media/assets/assets.ts#L230-L266","documentation":"Error \"Invalid file width\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/server/lib/media/assets/assets.ts:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}