{"record":{"id":"d42abd59366b7d3e","repo":"medusajs/medusa","slug":"promotion-s-status-should-be-one-of-allowedsta","errorCode":null,"errorMessage":"promotion's status should be one of - ${allowedStatuses.join(\", \")}","messagePattern":"promotion's status should be one of - (.+?)","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/promotion/workflows/update-promotions-status.ts","lineNumber":41,"sourceCode":"     * The ID of the promotion.\n     */\n    id: string\n    /**\n     * The new status of the promotion.\n     */\n    status: PromotionStatusValues\n  }[]\n} & AdditionalData\n\nexport const updatePromotionsValidationStep = createStep(\n  \"update-promotions-validation\",\n  async function ({ promotionsData }: UpdatePromotionsStatusWorkflowInput) {\n    for (const promotionData of promotionsData) {\n      const allowedStatuses: PromotionStatusValues[] =\n        Object.values(PromotionStatus)\n\n      if (!allowedStatuses.includes(promotionData.status)) {\n        throw new MedusaError(\n          MedusaError.Types.INVALID_DATA,\n          `promotion's status should be one of - ${allowedStatuses.join(\", \")}`\n        )\n      }\n    }\n  }\n)\n\nexport const updatePromotionsStatusWorkflowId = \"update-promotions-status\"\n/**\n * This workflow updates the status of one or more promotions.\n * \n * This workflow has a hook that allows you to perform custom actions on the updated promotions. For example, you can pass under `additional_data` custom data that\n * allows you to create custom data models linked to the promotions.\n * \n * You can also use this workflow within your customizations or your own custom workflows, allowing you to\n * update the status of promotions within your custom flows.\n * ","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/promotion/workflows/update-promotions-status.ts#L23-L59","documentation":"Thrown by the update-promotions-status workflow when a promotion's requested status is not a member of the PromotionStatus enum (active, inactive, draft). The workflow validates each entry before applying updates, rejecting the whole batch on the first invalid status. This guards state-machine integrity for promotions.","triggerScenarios":"Calling updatePromotionsStatusWorkflow (or admin route to update promotion status) with status values like 'enabled', 'published', 'archived', or arbitrary strings instead of 'active' | 'inactive' | 'draft'.","commonSituations":"Porting code from other Medusa entities (e.g. products use 'published'/'draft'); sending statuses from an external system with a different vocabulary; typo'd or case-mismatched status strings ('Active').","solutions":["Use one of the exact enum values: PromotionStatus.ACTIVE ('active'), INACTIVE ('inactive'), or DRAFT ('draft')","Check the PromotionStatus export from @medusajs/framework/utils or @medusajs/types and derive allowed values from it","If integrating external status vocabularies, map them to the allowed enum before calling the workflow"],"exampleFix":"// before\nawait updatePromotionsStatusWorkflow(container).run({\n  input: { promotionsData: [{ id: promo.id, status: 'enabled' }] },\n})\n\n// after\nawait updatePromotionsStatusWorkflow(container).run({\n  input: { promotionsData: [{ id: promo.id, status: 'active' }] },\n})","handlingStrategy":"type-guard","validationCode":"import { PromotionStatus } from '@medusajs/utils'\nconst allowed = Object.values(PromotionStatus) as string[]\nconst invalid = promotionsData.filter((p) => !allowed.includes(p.status))\nif (invalid.length) throw new Error(`invalid status for ${invalid.map((i) => i.id).join(', ')}`)","typeGuard":"import { PromotionStatus } from '@medusajs/utils'\nconst isValidPromotionStatus = (s: string): s is PromotionStatusValues => Object.values(PromotionStatus).includes(s as PromotionStatus)","tryCatchPattern":"try { await updatePromotionsStatusWorkflow(scope).run({ input }) } catch (e) { if (e instanceof MedusaError && /status should be one of/.test(e.message)) { /* remap status and retry */ } else throw e }","preventionTips":["Derive status from the PromotionStatus enum, never string literals","Map external status vocabularies to the enum at the boundary","Type the field as PromotionStatusValues in your payloads so invalid values fail at compile time"],"tags":["promotions","status","enum","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}