{"record":{"id":"911d7e27de534d7f","repo":"RocketChat/Rocket.Chat","slug":"invalid-store","errorCode":"invalid-store","errorMessage":"Store not found","messagePattern":"Store not found","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/ufs/ufs-methods.ts","lineNumber":17,"sourceCode":"import fs from 'node:fs';\n\nimport type { IUpload } from '@rocket.chat/core-typings';\nimport { check } from 'meteor/check';\nimport { Meteor } from 'meteor/meteor';\nimport type { ClientSession } from 'mongodb';\n\nimport { UploadFS } from './ufs';\n\nexport async function ufsComplete(fileId: string, storeName: string, options?: { session?: ClientSession }): Promise<IUpload> {\n\tcheck(fileId, String);\n\tcheck(storeName, String);\n\n\t// Get store\n\tconst store = UploadFS.getStore(storeName);\n\tif (!store) {\n\t\tthrow new Meteor.Error('invalid-store', 'Store not found');\n\t}\n\n\tconst tmpFile = UploadFS.getTempFilePath(fileId);\n\n\tconst removeTempFile = () =>\n\t\tfs.promises.unlink(tmpFile).catch(() => {\n\t\t\tconsole.warn(`[ufsComplete] Failed to remove temp file: ${tmpFile}`);\n\t\t});\n\n\treturn new Promise(async (resolve, reject) => {\n\t\ttry {\n\t\t\t// todo check if temp file exists\n\n\t\t\t// Get file\n\t\t\tconst file = await store.getCollection().findOne<IUpload>({ _id: fileId }, { session: options?.session });\n\n\t\t\tif (!file) {\n\t\t\t\tthrow new Meteor.Error('invalid-file', 'File is not valid');","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/ufs/ufs-methods.ts#L1-L35","documentation":"ufsComplete looks up the named UploadFS store via UploadFS.getStore(storeName); an unknown name returns undefined and the method throws Meteor.Error 'invalid-store' ('Store not found'). Stores are registered on the server at startup (e.g. Uploads, UserDataFiles, avatars); the name must match exactly what was registered.","triggerScenarios":"Calling ufsComplete(fileId, storeName) with a misspelled or unregistered store name, calling before server startup registered the stores, or invoking ufsComplete against a server process that does not own/register that store.","commonSituations":"Custom upload clients passing 'upload' instead of 'Uploads'; split-process deployments where the method runs where the store is not registered; typos in integrations using the UFS legacy API.","solutions":["Match the store name exactly to the registered store (check where UploadFS stores are defined/registered server-side).","Ensure ufsComplete runs on the process where the store is registered (single Meteor app process or correct service).","List registered stores at runtime (UploadFS stores map) during debugging to see the valid names."],"exampleFix":"// before\nawait Meteor.callAsync('ufsComplete', fileId, 'upload');\n\n// after\nawait Meteor.callAsync('ufsComplete', fileId, 'Uploads'); // exact registered store name","handlingStrategy":"validation","validationCode":"import { UploadFS } from '../ufs';\nconst store = UploadFS.getStore(storeName);\nif (!store) {\n  throw new Error(`Valid stores: ${Object.keys(UploadFS.stores).join(', ')}`);\n}","typeGuard":"const isValidStore = (name: string): boolean =>\n  Boolean(UploadFS.getStore(name));","tryCatchPattern":"try { await ufsComplete(fileId, storeName); } catch (e) { if (isMeteorError(e, 'invalid-store')) { /* fix storeName against registered stores */ return; } throw e; }","preventionTips":["Always use the storeName returned by ufsCreate.","Log the registered store names during development.","Keep ufsComplete calls on the process that owns the store."],"tags":["rocket-chat","file-upload","ufs","meteor"],"backgroundTag":"unknown-store-name","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"}