medusajs/medusa · error · MedusaError

A shipping method with id ${input.shipping_method_id} was no

Error message

A shipping method with id ${input.shipping_method_id} was not found

What it means

updateDraftOrderShippingMethodStep looks up the shipping method by id before updating; if no order shipping method matches input.shipping_method_id, it throws. Note it uses INVALID_DATA although it is semantically a not-found.

Source

Thrown at packages/core/core-flows/src/draft-order/steps/update-draft-order-shipping-metod.ts:66

  updateDraftOrderShippingMethodStepId,
  async function (
    input: UpdateDraftOrderShippingMethodStepInput,
    { container }
  ) {
    const service = container.resolve<IOrderModuleService>(Modules.ORDER)

    const [beforeUpdate] = await service.listOrderShippingMethods(
      {
        id: input.shipping_method_id,
      },
      {
        take: 1,
        select: ["id", "shipping_option_id", "amount"],
      }
    )

    if (!beforeUpdate) {
      throw new MedusaError(
        MedusaError.Types.INVALID_DATA,
        `A shipping method with id ${input.shipping_method_id} was not found`
      )
    }

    const [updatedMethod] = await service.updateOrderShippingMethods([
      {
        id: input.shipping_method_id,
        shipping_option_id: input.shipping_option_id,
        amount: input.amount,
      },
    ])

    return new StepResponse(
      {
        before: beforeUpdate,
        after: updatedMethod,
      },

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Re-fetch the draft order's shipping methods and use a current id
  2. Confirm the shipping method belongs to the same order before updating
  3. Handle the error by refreshing the draft order state in the client

Example fix

// before
await updateDraftOrderShippingMethodWorkflow(container).run({
  input: { order_id, shipping_method_id: oldId, data: { amount: 500 } },
})

// after: re-read current methods
const order = await query.graph({ entity: "order", filters: { id: order_id }, fields: ["shipping_methods.*"] })
const current = order.data[0].shipping_methods[0]
await updateDraftOrderShippingMethodWorkflow(container).run({
  input: { order_id, shipping_method_id: current.id, data: { amount: 500 } },
})
Defensive patterns

Strategy: validation

Validate before calling

const methods = await service.listOrderShippingMethods({ id: input.shipping_method_id, order_id: input.order_id })
if (!methods.length) throw new Error("Shipping method not on this order")

Try / catch

try { await workflow(scope).run({ input }) } catch (e) { if (/shipping method with id .* was not found/.test(e.message)) { /* refetch draft order methods, retry with current id */ } throw e }

Prevention

When it happens

Trigger: Calling the draft-order update-shipping-method workflow with a shipping_method_id that doesn't exist (or belongs to a different order).

Common situations: Stale UI passing an id from a previous draft version; shipping method already removed from the draft order; typo/truncated uuid; concurrent edit removed the method.

Related errors


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