medusajs/medusa · error · Error

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

Error message

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

What it means

Thrown when updating/removing a shipping method on a claim: the order change action found by action_id exists but its `action` type is not SHIPPING_ADD. The workflow only permits modifying actions that originally added a shipping method, so any other action type (e.g. ITEM_ADD, SHIPPING_REMOVE) is rejected.

Source

Thrown at packages/core/core-flows/src/order/workflows/claim/remove-claim-shipping-method.ts:91

  "validate-remove-claim-shipping-method",
  async function ({
    orderChange,
    orderClaim,
    input,
  }: RemoveClaimShippingMethodValidationStepInput) {
    throwIfIsCancelled(orderClaim, "Claim")
    throwIfOrderChangeIsNotActive({ orderChange })

    const associatedAction = (orderChange.actions ?? []).find(
      (a) => a.id === input.action_id
    ) as OrderChangeActionDTO

    if (!associatedAction) {
      throw new Error(
        `No shipping method found for claim ${input.claim_id} in order change ${orderChange.id}`
      )
    } else if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {
      throw new Error(
        `Action ${associatedAction.id} is not adding a shipping method`
      )
    }
  }
)

export const removeClaimShippingMethodWorkflowId =
  "remove-claim-shipping-method"
/**
 * This workflow removes an inbound (return) or outbound (delivery of new items) shipping method of a claim.
 * It's used by the [Remove Inbound Shipping Method](https://docs.medusajs.com/api/admin/claims/remove-inbound-shipping-method),
 * or [Remove Outbound Shipping Method](https://docs.medusajs.com/api/admin/claims/remove-outbound-shipping-method) Admin API Routes.
 * 
 * You can use this workflow within your customizations or your own custom workflows, allowing you to remove shipping methods from a claim
 * in your own custom flows.
 * 
 * @example
 * const { result } = await removeClaimShippingMethodWorkflow(container)

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Verify the action_id comes from the output of createClaimShippingMethodWorkflow (a SHIPPING_ADD action)
  2. Before calling, fetch the order change action and confirm its `action` field equals 'SHIPPING_ADD'
  3. If the shipping method was added by a different mechanism, use the workflow matching that action type instead

Example fix

// before
await updateClaimShippingMethodWorkflow(container).run({
  input: { claim_id, action_id: itemAction.id }, // wrong action
})

// after
const action = orderChange.actions.find((a) => a.id === actionId)
if (action?.action === ChangeActionType.SHIPPING_ADD) {
  await updateClaimShippingMethodWorkflow(container).run({
    input: { claim_id, action_id: action.id },
  })
}
Defensive patterns

Strategy: validation

Validate before calling

const action = orderChange.actions?.find((a) => a.id === actionId)
if (!action || action.action !== ChangeActionType.SHIPPING_ADD) {
  throw new Error(`Invalid action: ${actionId}`)
}

Type guard

const isShippingAddAction = (
  a?: OrderChangeActionDTO
): a is OrderChangeActionDTO & { action: 'SHIPPING_ADD' } =>
  !!a && a.action === ChangeActionType.SHIPPING_ADD

Prevention

When it happens

Trigger: Calling updateClaimShippingMethodWorkflow or removeClaimShippingMethodWorkflow with an action_id that points to an order change action whose action !== ChangeActionType.SHIPPING_ADD — e.g. passing the id of an item-add action instead of the shipping-method-add action.

Common situations: UI lists all order change actions and the user picks the wrong row; stale action_id stored from a previous claim; action_id copied from a different workflow's step output.

Related errors


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