medusajs/medusa · error · MedusaError

The following shipping options do not exist: ${Array.from(mi

Error message

The following shipping options do not exist: ${Array.from(missingShippingOptionIds).join(", ")}

What it means

Thrown by the Fulfillment module when updating shipping options that reference other shipping options (e.g. via `shipping_option_id` on rules or type data) where some of the referenced options do not exist in the database. The module diffs requested IDs against actually loaded options and reports the missing ones. It is a NOT_FOUND MedusaError.

Source

Thrown at packages/modules/fulfillment/src/services/fulfillment-module-service.ts:2108

        MedusaError.Types.INVALID_DATA,
        `Fulfillment with id ${fulfillment.id} already delivered`
      )
    }

    return true
  }

  protected static validateMissingShippingOptions_(
    shippingOptions: InferEntityType<typeof ShippingOption>[],
    shippingOptionsData: UpdateShippingOptionsInput[]
  ) {
    const missingShippingOptionIds = arrayDifference(
      shippingOptionsData.map((s) => s.id),
      shippingOptions.map((s) => s.id)
    )

    if (missingShippingOptionIds.length) {
      throw new MedusaError(
        MedusaError.Types.NOT_FOUND,
        `The following shipping options do not exist: ${Array.from(
          missingShippingOptionIds
        ).join(", ")}`
      )
    }
  }

  protected static validateMissingShippingOptionRules(
    shippingOption: InferEntityType<typeof ShippingOption>,
    shippingOptionUpdateData: FulfillmentTypes.UpdateShippingOptionDTO
  ) {
    if (!shippingOptionUpdateData.rules) {
      return
    }

    const existingRules = shippingOption.rules

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Verify the listed shipping option IDs exist: listShippingOptions({ id: [...] })
  2. Re-create or restore the missing shipping options before re-running the update
  3. Remove references to the deleted options from your update payload

Example fix

// before
await fulfillmentService.updateShippingOptions([
  { id: so.id, rules: [{ operator: 'eq', attribute: 'x', value: 'y', shipping_option_id: 'so_123' }] }, // so_123 deleted
])
// after
const existing = await fulfillmentService.listShippingOptions({ id: ['so_123'] })
if (!existing.length) {
  // recreate or drop the reference
}
Defensive patterns

Strategy: validation

Validate before calling

const existing = await fulfillmentService.listShippingOptions({ id: referencedIds })
const existingIds = new Set(existing.map((o) => o.id))
const missing = referencedIds.filter((id) => !existingIds.has(id))
if (missing.length) throw new Error(`Missing shipping options: ${missing.join(', ')}`)

Type guard

const isValidShippingOptionRef = (o: { id?: string }, ids: Set<string>): boolean => !!o.id && ids.has(o.id)

Try / catch

catch (e) { if (e instanceof MedusaError && e.type === MedusaError.Types.NOT_FOUND) { /* re-sync local option list */ } throw e }

Prevention

When it happens

Trigger: Calling fulfillmentModuleService.updateShippingOptions with entries whose rules or attached data reference shipping option IDs that were deleted or never created (e.g. after data migrations or copying configs between environments).

Common situations: Seed scripts referencing stale shipping option IDs, running updates after options were soft-deleted, or environment drift between staging and production data.

Related errors


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