{"record":{"id":"05110cf949cd92a6","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-asset","errorCode":"error-invalid-asset","errorMessage":"Invalid asset","messagePattern":"Invalid asset","errorType":"error_code","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/media/assets/assets.ts","lineNumber":233,"sourceCode":"\treturn assets[key as keyof IRocketChatAssets];\n}\n\nclass RocketChatAssetsClass {\n\tget assets(): IRocketChatAssets {\n\t\treturn assets;\n\t}\n\n\tpublic async setAssetWithBuffer(\n\t\tfile: Buffer,\n\t\tcontentType: string,\n\t\tasset: string,\n\t): Promise<{\n\t\tkey: string;\n\t\tvalue: IRocketChatAsset;\n\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}","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/media/assets/assets.ts#L215-L251","documentation":"Error \"Invalid asset\" thrown in RocketChat/Rocket.Chat.","triggerScenarios":"Thrown at apps/meteor/server/lib/media/assets/assets.ts:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the asset key passed to RocketChat.Assets.setAsset is one of the registered assets (e.g. logo, favicon) before calling setAsset.","Check the asset name for typos; getAssetByKey returned undefined for the given key."],"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"}