medusajs/medusa · warning
Failed to clear events for eventGroupId - ${flowEventGroupId
Error message
Failed to clear events for eventGroupId - ${flowEventGroupId} What it means
When a workflow run finishes in a FAILED or REVERTED state, the workflow engine tries to clear the event-bus events that were buffered under the run's eventGroupId so half-finished work doesn't emit events. If eventBusService.clearGroupedEvents rejects, the failure is swallowed and only this warning is logged.
Source
Thrown at packages/core/workflows-sdk/src/helper/workflow-export.ts:643
const eventBusService = (
flow.container as MedusaContainer
).resolve<IEventBusModuleService>(Modules.EVENT_BUS, {
allowUnregistered: true,
})
if (!eventBusService || !flowEventGroupId) {
await onFinish?.(args)
return
}
const failedStatus = [TransactionState.FAILED, TransactionState.REVERTED]
if (failedStatus.includes(transaction.getState())) {
return await eventBusService
.clearGroupedEvents(flowEventGroupId)
.catch(() => {
logger.warn(
`Failed to clear events for eventGroupId - ${flowEventGroupId}`
)
})
}
await eventBusService
.releaseGroupedEvents(flowEventGroupId)
.then(async () => {
await onFinish?.(args)
})
.catch((e) => {
logger.error(
`Failed to release grouped events for eventGroupId: ${flowEventGroupId}`,
e
)
return flow.cancel(transaction)
})View on GitHub (pinned to 5e06e544a2)
Solutions
- Check the event bus module and its database for errors around the failure time — the root cause is the workflow failure; the clear failure is secondary
- If using a custom event bus module, implement clearGroupedEvents(eventGroupId)
- Retry the workflow run; on success a new eventGroupId is used and the stale group can be purged manually
- Inspect the event_group table (or equivalent) for orphaned groups and clean them up if they accumulate
Defensive patterns
Strategy: try-catch
Try / catch
try {
await eventBusService.clearGroupedEvents(eventGroupId)
} catch {
logger.warn(`Failed to clear events for eventGroupId - ${eventGroupId}`)
// optionally enqueue retry/cleanup of the event group
} Prevention
- Implement clearGroupedEvents on custom event bus modules
- Keep the event bus DB healthy; investigate workflow failures that trigger cleanup
- Periodically inspect for orphaned event groups after outages
When it happens
Trigger: A workflow whose transaction state is FAILED or REVERTED AND the event bus (e.g. the EventBus module's internal storage) errors when deleting the grouped events — DB connectivity issues, missing table, or an event-bus service that doesn't support clearing.
Common situations: Workflows failing during a database outage so cleanup also fails; custom/local event bus modules that don't implement clearGroupedEvents; transient DB restarts while a long workflow is reverting.
Related errors
- Method 'clearExpiredExecutions' not implemented.
- The subscriber in ${path} is not a function. skipped.
- The subscriber in ${path} is missing a config. skipped.
- The subscriber in ${path} is missing an event in the config.
- The subscriber in ${path} has an invalid event config. The e
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/db786df479161b2f.
Report an issue: GitHub.