{"record":{"id":"d0c747d8eb1f7fa7","repo":"RocketChat/Rocket.Chat","slug":"this-instance-could-not-remove-the-item-info-nam","errorCode":null,"errorMessage":"This instance could not remove the ${item.info.name} app package. If you are running Rocket.Chat in a cluster with multiple instances, possibly other instance removed the package. If this is not the case, it is possible that the file in the database got renamed or removed manually.","messagePattern":"This instance could not remove the (.+?) app package\\. If you are running Rocket\\.Chat in a cluster with multiple instances, possibly other instance removed the package\\. If this is not the case, it is possible that the file in the database got renamed or removed manually\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/meteor/ee/server/apps/storage/AppGridFSSourceStorage.ts","lineNumber":65,"sourceCode":"\t\t\t\t\tresolve(this.idToPath(writeStream.id));\n\t\t\t\t\t// An error in the following line would not cause the update process to fail\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-empty-function\n\t\t\t\t\tthis.remove(item).catch(() => {});\n\t\t\t\t})\n\n\t\t\t\t.on('error', (error: any) => reject(error));\n\n\t\t\twriteStream.write(zip);\n\t\t\twriteStream.end();\n\t\t});\n\t}\n\n\tpublic async remove(item: IAppStorageItem): Promise<void> {\n\t\ttry {\n\t\t\tawait this.bucket.delete(this.itemToObjectId(item));\n\t\t} catch (error: any) {\n\t\t\tif (error.message.includes('File not found for id')) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`This instance could not remove the ${item.info.name} app package. If you are running Rocket.Chat in a cluster with multiple instances, possibly other instance removed the package. If this is not the case, it is possible that the file in the database got renamed or removed manually.`,\n\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate itemToFilename(item: IAppStorageItem): string {\n\t\treturn `${item.info.nameSlug}-${item.info.version}.package`;\n\t}\n\n\tprivate idToPath(id: NpmModuleMongodb.GridFSBucketWriteStream['id']): string {\n\t\treturn this.pathPrefix + id;\n\t}\n\n\tprivate itemToObjectId(item: IAppStorageItem): ObjectId {\n\t\treturn new ObjectId(item.sourcePath?.substring(this.pathPrefix.length));","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/ee/server/apps/storage/AppGridFSSourceStorage.ts#L47-L83","documentation":"The GridFS-backed app package storage failed to delete an app's package file, and the MongoDB error contained 'File not found for id' — the stored file for the app no longer exists. In a multi-instance cluster the usual cause is another instance winning the delete race during an uninstall/update; otherwise the file was manually renamed or removed from the database. The instance only warns and returns, so app-record removal continues without the file.","triggerScenarios":"Uninstalling or updating the same app on two Rocket.Chat instances at the same moment; a previous uninstall deleted the GridFS file but died before cleaning the app record; manual deletion/rename of documents in the fs.files/fs.chunks (Uploads/GridFS) collections leaving the app storage item pointing at a stale file id.","commonSituations":"Cluster deployments where app operations land on different nodes; partial uninstalls after crashes or disk-full errors; admins doing manual database surgery on upload collections.","solutions":["In a cluster this is expected and harmless — confirm only one instance was processing the uninstall and ignore","Single instance: query GridFS (fs.files) for the '<nameSlug>-<version>.package' file to see if it was renamed or removed manually","If records are inconsistent, reinstall the app and uninstall it again to reconcile app record and stored package"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// check the GridFS file exists before deleting, making the race explicit\nconst [file] = await bucket.find({ _id: itemToObjectId(item) }, { limit: 1 }).toArray();\nif (!file) {\n\t// already removed by another instance or manually — nothing to do\n\treturn;\n}\nawait bucket.delete(itemToObjectId(item));","typeGuard":null,"tryCatchPattern":"try {\n\tawait bucket.delete(id);\n} catch (error: any) {\n\tif (/File not found for id/.test(String(error?.message))) return; // benign race\n\tthrow error;\n}","preventionTips":["Route app install/uninstall operations through one instance (or a leadership election) in clustered deployments","Avoid manual edits to GridFS/GridFS-upload collections; use the admin APIs so records and files stay consistent","After a failed uninstall, reinstall and uninstall again instead of deleting half the records by hand"],"tags":["gridfs","apps-engine","cluster","storage","uninstall"],"backgroundTag":"file-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}