{"record":{"id":"cd8c0ae690c5f783","repo":"RocketChat/Rocket.Chat","slug":"error-importer-not-defined","errorCode":"error-importer-not-defined","errorMessage":"The Pending File Importer was not found.","messagePattern":"The Pending File Importer was not found\\.","errorType":"exception","errorClass":"Meteor.Error","httpStatus":400,"severity":"error","filePath":"apps/meteor/server/api/v1/import.ts","lineNumber":217,"sourceCode":");\n\nAPI.v1.post(\n\t'downloadPendingFiles',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['run-import'],\n\t\tbody: isDownloadPendingFilesParamsPOST,\n\t\tresponse: {\n\t\t\t200: countResponseSchema,\n\t\t\t400: validateBadRequestErrorResponse,\n\t\t\t401: validateUnauthorizedErrorResponse,\n\t\t\t403: validateForbiddenErrorResponse,\n\t\t},\n\t},\n\tasync function action() {\n\t\tconst importer = Importers.get('pending-files');\n\t\tif (!importer) {\n\t\t\tthrow new Meteor.Error('error-importer-not-defined', 'The Pending File Importer was not found.', 'downloadPendingFiles');\n\t\t}\n\n\t\tconst operation = await Import.newOperation(this.userId, importer.name, importer.key);\n\t\tconst instance = new PendingFileImporter(importer, operation);\n\t\tconst count = await instance.prepareFileCount();\n\n\t\treturn API.v1.success({\n\t\t\tcount,\n\t\t});\n\t},\n);\n\nAPI.v1.post(\n\t'downloadPendingAvatars',\n\t{\n\t\tauthRequired: true,\n\t\tpermissionsRequired: ['run-import'],\n\t\tbody: isDownloadPendingAvatarsParamsPOST,","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/api/v1/import.ts#L199-L235","documentation":"POST /api/v1/downloadPendingFiles requires the internal importer registered under the key 'pending-files'. That registration is unconditional at server startup: apps/meteor/server/importPackages.ts imports ./lib/import/pending-files which calls Importers.add({key: 'pending-files', ...}). error-importer-not-defined (import.ts:217) therefore means the registry lookup returned undefined - effectively impossible on a stock build; it indicates a deployment where that module never loaded (trimmed custom image, partial startup, or a fork that rewired importer registration).","triggerScenarios":"Calling POST /api/v1/downloadPendingFiles (requires run-import permission) on a custom build that prunes server modules or skips importPackages.ts; a monkey-patched Importers registry; startup errors that aborted module loading.","commonSituations":"Custom Docker images stripping 'unused' server code; test harnesses that import API routes without the import packages; forks that replaced the importer subsystem.","solutions":["Restart the server and confirm the module loads - registration has no conditions, so a healthy stock build always registers it","On custom builds, verify apps/meteor/server/importPackages.ts still imports ./lib/import/pending-files and nothing filters Importers.add","Compare behavior against an unmodified build; if it works there, the deployment trimmed or replaced the module"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await api.post('/api/v1/downloadPendingFiles', { ... });\n} catch (err) {\n  if (err.response?.body?.error === 'error-importer-not-defined') {\n    // deployment-level defect on stock builds - report to the operator, do not retry\n    throw new Error('pending-files importer not registered: custom build or broken startup - verify importPackages.ts');\n  }\n  throw err;\n}","preventionTips":["Smoke-test import endpoints after any custom build/image change","Do not strip server modules without checking registration side effects (Importers.add at import time)","Confirm a plain restart fixes it before assuming data problems"],"tags":["import","migration","rest-api","startup","registration"],"backgroundTag":"service-not-registered","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}