medusajs/medusa · error · MedusaError

Action ${associatedAction.id} is not adding a shipping metho

Error message

Action ${associatedAction.id} is not adding a shipping method

What it means

Second phase of draft-order shipping action validation: the action exists but its type is not SHIPPING_ADD, so it cannot be treated as a shipping-method addition (e.g. for removal or amount update).

Source

Thrown at packages/core/core-flows/src/draft-order/steps/validate-draft-order-shipping-method-action.ts:64

export const validateDraftOrderShippingMethodActionStep = createStep(
  "validate-draft-order-shipping-method-action",
  async function ({
    input,
    orderChange,
  }: ValidateDraftOrderShippingMethodActionStepInput) {
    const associatedAction = (orderChange.actions ?? []).find(
      (a) => a.id === input.action_id
    ) as OrderChangeActionDTO

    if (!associatedAction) {
      throw new MedusaError(
        MedusaError.Types.INVALID_DATA,
        `No shipping method found for order ${input.order_id} in order change ${orderChange.id}`
      )
    }

    if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {
      throw new MedusaError(
        MedusaError.Types.INVALID_DATA,
        `Action ${associatedAction.id} is not adding a shipping method`
      )
    }
  }
)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Check action.action === 'SHIPPING_ADD' before calling the shipping action workflow
  2. Route item actions to the item-action workflow
  3. Re-fetch actions and render their types in the UI

Example fix

// before
await deleteDraftOrderShippingMethodWorkflow(container).run({ input: { order_id, action_id } }) // ITEM_ADD action

// after
if (action.action === "SHIPPING_ADD") {
  await deleteDraftOrderShippingMethodWorkflow(container).run({ input: { order_id, action_id: action.id } })
} else {
  await removeItemDraftOrderWorkflow(container).run({ input: { order_id, action_id: action.id } })
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (action.action !== "SHIPPING_ADD") throw new Error("Not a shipping-add action")

Type guard

const isShippingAddAction = (a: { action: string }) => a.action === "SHIPPING_ADD"

Prevention

When it happens

Trigger: Passing an ITEM_ADD or other non-SHIPPING_ADD action id to a draft-order shipping method action workflow.

Common situations: Client routes all action removals through the shipping workflow; stale action list where the action type differs from what the UI assumed.

Related errors


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