medusajs/medusa · error · Error
Method 'clearExpiredExecutions' not implemented.
Error message
Method 'clearExpiredExecutions' not implemented.
What it means
clearExpiredExecutions is a maintenance hook the workflow engine can call to purge expired workflow executions from storage. Like the other optional members of AbstractTransactionStore, the default implementation throws to indicate the adapter does not support cleanup.
Source
Thrown at packages/core/orchestration/src/transaction/datastore/abstract-storage.ts:150
async scheduleStepTimeout(
transaction: DistributedTransactionType,
step: TransactionStep,
timestamp: number,
interval: number
): Promise<void> {
throw new Error("Method 'scheduleStepTimeout' not implemented.")
}
async clearStepTimeout(
transaction: DistributedTransactionType,
step: TransactionStep
): Promise<void> {
throw new Error("Method 'clearStepTimeout' not implemented.")
}
async clearExpiredExecutions(): Promise<void> {
throw new Error("Method 'clearExpiredExecutions' not implemented.")
}
}
View on GitHub (pinned to 5e06e544a2)
Solutions
- Implement clearExpiredExecutions in your adapter (delete executions past their expiration from your store)
- If cleanup is handled externally (TTL policies, cron SQL), implement it as a no-op instead of leaving the throwing stub
- Use the built-in Redis storage which implements expiry via key TTL
Example fix
// before
async clearExpiredExecutions() {
throw new Error("not implemented")
}
// after
async clearExpiredExecutions() {
await this.dataSource.query(
`DELETE FROM workflow_execution WHERE expired_at < now()`
)
} Defensive patterns
Strategy: validation
Validate before calling
if (storage.clearExpiredExecutions === AbstractTransactionStore.prototype.clearExpiredExecutions) {
// disable scheduled cleanup or implement it
console.warn('Execution cleanup unsupported; skipping schedule')
} Prevention
- Decide retention strategy up front: adapter-level cleanup, external cron, or TTL — and implement clearExpiredExecutions accordingly
When it happens
Trigger: The workflow engine (or an explicit cleanup schedule) invokes clearExpiredExecutions on the configured storage, and the custom storage adapter did not override it — typically when workflows run with expiration configured or when a scheduled cleanup runs.
Common situations: Custom storage adapters written against an older API; enabling workflow retention/cleanup features on an adapter that never implemented them; upgrading to a Medusa version that periodically calls cleanup.
Related errors
- Method 'clearTransactionTimeout' not implemented.
- Method 'scheduleStepTimeout' not implemented.
- Method 'clearStepTimeout' not implemented.
- Unable to serialize context object. Please make sure the wor
- TransactionModel "${transaction.modelId}" cannot be orchestr
AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27).
Data as JSON: /api/errors/6ce60f2750435974.
Report an issue: GitHub.