{"record":{"id":"94906ea2636c03e2","repo":"medusajs/medusa","slug":"invalid-data-94906e","errorCode":"invalid_data","errorMessage":"The promotion code ${code} is invalid","messagePattern":"The promotion code (.+?) is invalid","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/cart/steps/get-promotion-codes-to-apply.ts","lineNumber":120,"sourceCode":"              await query.graph(\n                {\n                  entity: \"promotion\",\n                  fields: [\"id\", \"code\"],\n                  filters: { code: promo_codes },\n                },\n                {\n                  cache: {\n                    enable: true,\n                  },\n                }\n              )\n            ).data.map((p) => p.code!)\n          : []\n      )\n\n      promo_codes.forEach((code) => {\n        if (!validPromoCodes.has(code)) {\n          throw new MedusaError(\n            MedusaError.Types.INVALID_DATA,\n            `The promotion code ${code} is invalid`\n          )\n        }\n        promotionCodesToApply.add(code)\n      })\n    }\n\n    return new StepResponse(\n      Array.from(promotionCodesToApply) as GetPromotionCodesToApplyStepOutput\n    )\n  }\n)\n","sourceCodeStart":102,"sourceCodeEnd":134,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/cart/steps/get-promotion-codes-to-apply.ts#L102-L134","documentation":"Identical to the getRunningTransaction case but hit via retryStep in the Redis engine: the idempotency key is parsed into workflowId/transactionId, and if the workflow isn't in the MedusaWorkflow registry, retry is aborted with this error.","triggerScenarios":"engine.retryStep(idempotencyKey) with a malformed key or a key whose workflowId references a workflow not loaded in this process.","commonSituations":"Retry handlers in separate workers that don't import the original workflow; hand-built keys; key-format drift across versions.","solutions":["Retry using the idempotency key originally returned by the engine","Import the workflow module in the retrying process","Validate the key's workflowId against the registry before calling"],"exampleFix":"// before\nawait engine.retryStep(key)\n// after\nif (!MedusaWorkflow.getWorkflow(parseKey(key).workflowId)) throw new Error('unknown workflow')\nawait engine.retryStep(key)","handlingStrategy":"type-guard","validationCode":"const [_, { workflowId }] = engine.buildIdempotencyKeyAndParts(idempotencyKey)\nif (!MedusaWorkflow.getWorkflow(workflowId)) throw new Error('unknown workflow in key')\nawait engine.retryStep(idempotencyKey)","typeGuard":"const isRetryableKey = (k: string) => Boolean(MedusaWorkflow.getWorkflow(engine.buildIdempotencyKeyAndParts(k)[1].workflowId))","tryCatchPattern":"catch (e) { if (e.message.includes('not found')) return deadLetter(key); throw e }","preventionTips":["Persist engine-produced idempotency keys verbatim","Register workflows in the process performing retries"],"tags":["workflow-engine","redis","idempotency-key"],"backgroundTag":"workflow-not-registered","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}