RocketChat/Rocket.Chat · error · Meteor.Error
error-invalid-integration-history
error-invalid-integration-history
Error message
Invalid Integration History
What it means
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.
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
Defensive patterns
Strategy: validation
Validate before calling
const history = await IntegrationHistory.findOneByIntegrationIdAndHistoryId(integrationId, historyId);
if (!history) {
// nothing to replay: refresh the history list instead of submitting
} Prevention
- Refresh the history list right before enabling a replay action
- Expect history ids to disappear after clearIntegrationHistory runs
When it happens
Trigger: Replaying a history record that was already removed — e.g. after clearIntegrationHistory wiped it — or passing a historyId belonging to a different integration.
Common situations: History cleared while a replay dialog was open; stale history lists in the admin UI; copy/paste of history ids between environments.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- error-contact-not-found
- error-invalid-integration
- error-invalid-integration
- error-invalid-room
- error-invalid-room
AI-assisted analysis of RocketChat/Rocket.Chat@b2c16d5842 (2026-08-18).
Data as JSON: /api/errors/a302c94ebbbab33e.
Report an issue: GitHub.
Appendix: source
Thrown at apps/meteor/server/lib/integrations/functions/clearIntegrationHistory.ts:58
} else if (await hasPermissionAsync(userId, 'manage-own-outgoing-integrations')) {
const found = await Integrations.findOne<IOutgoingIntegration>({
'_id': integrationId,
'_createdBy._id': userId,
});
if (found && 'event' in found) {
integration = found;
}
}
if (!integration) {
throw new Meteor.Error('error-invalid-integration', 'Invalid integration', { method: 'replayOutgoingIntegration' });
}
const history = await IntegrationHistory.findOneByIntegrationIdAndHistoryId(integration._id, historyId);
if (!history) {
throw new Meteor.Error('error-invalid-integration-history', 'Invalid Integration History', { method: 'replayOutgoingIntegration' });
}
await triggerHandler.replay(integration, history);
};
View on GitHub (pinned to b2c16d5842)