medusajs/medusa · error · MedusaError

promotion's status should be one of - ${allowedStatuses.join

Error message

promotion's status should be one of - ${allowedStatuses.join(", ")}

What it means

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.

Source

Thrown at packages/core/core-flows/src/promotion/workflows/update-promotions-status.ts:41

     * The ID of the promotion.
     */
    id: string
    /**
     * The new status of the promotion.
     */
    status: PromotionStatusValues
  }[]
} & AdditionalData

export const updatePromotionsValidationStep = createStep(
  "update-promotions-validation",
  async function ({ promotionsData }: UpdatePromotionsStatusWorkflowInput) {
    for (const promotionData of promotionsData) {
      const allowedStatuses: PromotionStatusValues[] =
        Object.values(PromotionStatus)

      if (!allowedStatuses.includes(promotionData.status)) {
        throw new MedusaError(
          MedusaError.Types.INVALID_DATA,
          `promotion's status should be one of - ${allowedStatuses.join(", ")}`
        )
      }
    }
  }
)

export const updatePromotionsStatusWorkflowId = "update-promotions-status"
/**
 * This workflow updates the status of one or more promotions.
 * 
 * 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
 * allows you to create custom data models linked to the promotions.
 * 
 * You can also use this workflow within your customizations or your own custom workflows, allowing you to
 * update the status of promotions within your custom flows.
 * 

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Use one of the exact enum values: PromotionStatus.ACTIVE ('active'), INACTIVE ('inactive'), or DRAFT ('draft')
  2. Check the PromotionStatus export from @medusajs/framework/utils or @medusajs/types and derive allowed values from it
  3. If integrating external status vocabularies, map them to the allowed enum before calling the workflow

Example fix

// before
await updatePromotionsStatusWorkflow(container).run({
  input: { promotionsData: [{ id: promo.id, status: 'enabled' }] },
})

// after
await updatePromotionsStatusWorkflow(container).run({
  input: { promotionsData: [{ id: promo.id, status: 'active' }] },
})
Defensive patterns

Strategy: type-guard

Validate before calling

import { PromotionStatus } from '@medusajs/utils'
const allowed = Object.values(PromotionStatus) as string[]
const invalid = promotionsData.filter((p) => !allowed.includes(p.status))
if (invalid.length) throw new Error(`invalid status for ${invalid.map((i) => i.id).join(', ')}`)

Type guard

import { PromotionStatus } from '@medusajs/utils'
const isValidPromotionStatus = (s: string): s is PromotionStatusValues => Object.values(PromotionStatus).includes(s as PromotionStatus)

Try / catch

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 }

Prevention

When it happens

Trigger: Calling updatePromotionsStatusWorkflow (or admin route to update promotion status) with status values like 'enabled', 'published', 'archived', or arbitrary strings instead of 'active' | 'inactive' | 'draft'.

Common situations: 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').

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of medusajs/medusa@5e06e544a2 (2026-08-27). Data as JSON: /api/errors/d42abd59366b7d3e. Report an issue: GitHub.