{"record":{"id":"a302c94ebbbab33e","repo":"RocketChat/Rocket.Chat","slug":"error-invalid-integration-history","errorCode":"error-invalid-integration-history","errorMessage":"Invalid Integration History","messagePattern":"Invalid Integration History","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/lib/integrations/functions/clearIntegrationHistory.ts","lineNumber":58,"sourceCode":"\t} else if (await hasPermissionAsync(userId, 'manage-own-outgoing-integrations')) {\n\t\tconst found = await Integrations.findOne<IOutgoingIntegration>({\n\t\t\t'_id': integrationId,\n\t\t\t'_createdBy._id': userId,\n\t\t});\n\n\t\tif (found && 'event' in found) {\n\t\t\tintegration = found;\n\t\t}\n\t}\n\n\tif (!integration) {\n\t\tthrow new Meteor.Error('error-invalid-integration', 'Invalid integration', { method: 'replayOutgoingIntegration' });\n\t}\n\n\tconst history = await IntegrationHistory.findOneByIntegrationIdAndHistoryId(integration._id, historyId);\n\n\tif (!history) {\n\t\tthrow new Meteor.Error('error-invalid-integration-history', 'Invalid Integration History', { method: 'replayOutgoingIntegration' });\n\t}\n\n\tawait triggerHandler.replay(integration, history);\n};\n","sourceCodeStart":40,"sourceCodeEnd":63,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/lib/integrations/functions/clearIntegrationHistory.ts#L40-L63","documentation":"The outgoing integration resolved fine, but IntegrationHistory.findOneByIntegrationIdAndHistoryId found no history entry with that historyId for it, so there is no recorded event to replay. The lookup is scoped to the integration's own history, so ids from other integrations also fail.","triggerScenarios":"Replaying a history record that was already removed — e.g. after clearIntegrationHistory wiped it — or passing a historyId belonging to a different integration.","commonSituations":"History cleared while a replay dialog was open; stale history lists in the admin UI; copy/paste of history ids between environments.","solutions":["Refresh the integration's history list and replay an entry that still exists","If history was cleared, trigger the integration again to generate a new event, then replay that"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const history = await IntegrationHistory.findOneByIntegrationIdAndHistoryId(integrationId, historyId);\nif (!history) {\n  // nothing to replay: refresh the history list instead of submitting\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refresh the history list right before enabling a replay action","Expect history ids to disappear after clearIntegrationHistory runs"],"tags":["integrations","history","not-found"],"backgroundTag":"record-not-found","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}