{"record":{"id":"1c05d2cde5279b23","repo":"RocketChat/Rocket.Chat","slug":"error-operation-not-found-1c05d2","errorCode":"error-operation-not-found","errorMessage":"Import Operation Not Found","messagePattern":"Import Operation Not Found","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/import/getImportProgress.ts","lineNumber":13,"sourceCode":"import type { IImportProgress } from '@rocket.chat/core-typings';\nimport type { ServerMethods } from '@rocket.chat/ddp-client';\nimport { Imports } from '@rocket.chat/models';\nimport { Meteor } from 'meteor/meteor';\n\nimport { hasPermissionAsync } from '../../lib/authorization/hasPermission';\nimport { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';\nimport { Importers } from '../../lib/import';\n\nexport const executeGetImportProgress = async (): Promise<IImportProgress> => {\n\tconst operation = await Imports.findLastImport();\n\tif (!operation) {\n\t\tthrow new Meteor.Error('error-operation-not-found', 'Import Operation Not Found', 'getImportProgress');\n\t}\n\n\tconst { importerKey } = operation;\n\tconst importer = Importers.get(importerKey);\n\tif (!importer) {\n\t\tthrow new Meteor.Error('error-importer-not-defined', `The importer (${importerKey}) has no import class defined.`, 'getImportProgress');\n\t}\n\n\tconst instance = new importer.importer(importer, operation); // eslint-disable-line new-cap\n\n\treturn instance.getProgress();\n};\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tgetImportProgress(): IImportProgress;\n\t}","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/import/getImportProgress.ts#L1-L31","documentation":"getImportProgress starts with `Imports.findLastImport()`; when no import operation document exists at all, it throws error-operation-not-found. In other words, no import has ever been started (or the last one was removed) on this workspace, so there is no progress to report.","triggerScenarios":"Calling `Meteor.call('getImportProgress')` (or POST /v1/getImportProgress) before any uploadImportFile / import setup has created a record in the `imports` collection; also when the imports collection was cleared.","commonSituations":"Import UIs that poll progress as soon as the page opens instead of after starting an import; fresh installs; automated flows that skip the upload step; polling after the operation document was deleted.","solutions":["Start an import first: `Meteor.call('uploadImportFile', binaryContent, contentType, fileName, 'csv')` (requires login + run-import)","Or check state first via `Meteor.call('getLatestImportOperations')` (needs view-import-operations) and only poll progress when a non-empty list returns","Treat this error as 'no import yet' in polling loops: stop polling instead of retrying"],"exampleFix":"// before\nMeteor.call('getImportProgress', cb); // error-operation-not-found on fresh workspace\n\n// after — only poll once an operation exists\nMeteor.call('getLatestImportOperations', (e, ops) => {\n  if (ops?.length) Meteor.call('getImportProgress', cb);\n});","handlingStrategy":"validation","validationCode":"// Confirm an operation exists before polling progress\nMeteor.call('getLatestImportOperations', (e, ops) => {\n  if (e || !ops?.length) {\n    // no import yet — run uploadImportFile first instead of calling getImportProgress\n  }\n});","typeGuard":null,"tryCatchPattern":"try {\n  const progress = await meteorCall('getImportProgress');\n} catch (e) {\n  if (e instanceof Meteor.Error && e.error === 'error-operation-not-found') {\n    // no import started: begin the upload flow, stop polling\n  }\n}","preventionTips":["Only start progress polling after uploadImportFile succeeds","Model 'no operation' as an expected state in the import UI","Order the flow: upload → poll progress → selection → start"],"tags":["rocket-chat","import","not-found","meteor-methods"],"backgroundTag":"import-operation-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}