{"record":{"id":"6ce60f2750435974","repo":"medusajs/medusa","slug":"method-clearexpiredexecutions-not-implemented","errorCode":null,"errorMessage":"Method 'clearExpiredExecutions' not implemented.","messagePattern":"Method 'clearExpiredExecutions' not implemented\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/orchestration/src/transaction/datastore/abstract-storage.ts","lineNumber":150,"sourceCode":"\n  async scheduleStepTimeout(\n    transaction: DistributedTransactionType,\n    step: TransactionStep,\n    timestamp: number,\n    interval: number\n  ): Promise<void> {\n    throw new Error(\"Method 'scheduleStepTimeout' not implemented.\")\n  }\n\n  async clearStepTimeout(\n    transaction: DistributedTransactionType,\n    step: TransactionStep\n  ): Promise<void> {\n    throw new Error(\"Method 'clearStepTimeout' not implemented.\")\n  }\n\n  async clearExpiredExecutions(): Promise<void> {\n    throw new Error(\"Method 'clearExpiredExecutions' not implemented.\")\n  }\n}\n","sourceCodeStart":132,"sourceCodeEnd":153,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/orchestration/src/transaction/datastore/abstract-storage.ts#L132-L153","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nasync clearExpiredExecutions() {\n  throw new Error(\"not implemented\")\n}\n\n// after\nasync clearExpiredExecutions() {\n  await this.dataSource.query(\n    `DELETE FROM workflow_execution WHERE expired_at < now()`\n  )\n}","handlingStrategy":"validation","validationCode":"if (storage.clearExpiredExecutions === AbstractTransactionStore.prototype.clearExpiredExecutions) {\n  // disable scheduled cleanup or implement it\n  console.warn('Execution cleanup unsupported; skipping schedule')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide retention strategy up front: adapter-level cleanup, external cron, or TTL — and implement clearExpiredExecutions accordingly"],"tags":["orchestration","workflow","cleanup","storage-adapter"],"backgroundTag":"unimplemented-abstract-method","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}