{"record":{"id":"86d2dbc40cca3373","repo":"medusajs/medusa","slug":"invalid-data-86d2db","errorCode":"invalid_data","errorMessage":"Shipping option with ID ${shippingOption.id} do not have a price","messagePattern":"Shipping option with ID (.+?) do not have a price","errorType":"validation","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/cart/workflows/add-shipping-method-to-cart.ts","lineNumber":169,"sourceCode":"\n    const validatedMethodData = validateAndReturnShippingMethodsDataStep(\n      validateShippingMethodsDataInput\n    )\n\n    const shippingMethodInput = transform(\n      {\n        input,\n        shippingOptions,\n        validatedMethodData,\n      },\n      (data) => {\n        const options = (data.input.options ?? []).map((option) => {\n          const shippingOption = data.shippingOptions.find(\n            (so) => so.id === option.id\n          )!\n\n          if (!shippingOption?.calculated_price) {\n            throw new MedusaError(\n              MedusaError.Types.INVALID_DATA,\n              `Shipping option with ID ${shippingOption.id} do not have a price`\n            )\n          }\n\n          const methodData = data.validatedMethodData?.find((methodData) => {\n            return methodData?.[option.id]\n          })\n\n          return {\n            shipping_option_id: shippingOption.id,\n            amount: shippingOption.calculated_price.calculated_amount,\n            is_tax_inclusive:\n              !!shippingOption.calculated_price\n                .is_calculated_price_tax_inclusive,\n            data: methodData?.[option.id] ?? {},\n            name: shippingOption.name,\n            cart_id: data.input.cart_id,","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/cart/workflows/add-shipping-method-to-cart.ts#L151-L187","documentation":"addShippingMethodToCartWorkflow validates that every shipping option in the input has a calculated price for the cart's context (region/currency). Without a calculated_price the shipping method cannot be priced, so the step aborts with invalid_data.","triggerScenarios":"Calling addShippingMethodToCart with an option id whose prices were deleted, are scoped to another region/currency, or whose price calculation (e.g. flat rate rules or provider calculation) returned nothing for this cart.","commonSituations":"Shipping option prices created only for one region while the cart belongs to another; price records removed or expired; currency mismatch between cart and price; misconfigured price rules for calculated (provider-based) shipping options.","solutions":["Verify the shipping option has a price for the cart's region and currency (Admin: Shipping > option > prices, or query pricing)","Add the missing region/currency price for the option and retry","If using a calculated option, check the fulfillment provider's price calculation returns a value for this cart","Confirm the cart's region_id is the one you intended before adding the method"],"exampleFix":"// before\nawait addShippingMethodToCartWorkflow(container).run({ input: { cart_id, option_id: soId } })\n\n// after (verify price first)\nconst { data: [so] } = await query.graph({ entity: 'shipping_option', fields: ['*', 'prices.*'], filters: { id: soId } })\nif (!so.prices.some((p) => p.currency_code === cart.currency_code)) {\n  throw new Error('Option not priced for cart currency — add price in admin')\n}\nawait addShippingMethodToCartWorkflow(container).run({ input: { cart_id, option_id: soId } })","handlingStrategy":"validation","validationCode":"const { data: [so] } = await query.graph({ entity: 'shipping_option', fields: ['id', 'prices.currency_code', 'prices.region_id'], filters: { id: option_id } })\nconst priced = so.prices.some((p) => p.region_id === cart.region_id || p.currency_code === cart.currency_code)\nif (!priced) throw new Error('Shipping option not priced for this cart context')","typeGuard":"const isPricedForCart = (so: ShippingOptionDTO, cart: CartDTO) =>\n  so.prices?.some((p) => p.region_id === cart.region_id || p.currency_code === cart.currency_code) ?? false","tryCatchPattern":"try {\n  await addShippingMethodToCartWorkflow(container).run({ input })\n} catch (e) {\n  if (e instanceof MedusaError && /do not have a price/.test(e.message)) {\n    // exclude option from shipping list, notify merchant to add region price\n  }\n}","preventionTips":["Keep every shipping option priced for every region it is offered in","Filter the shipping options list shown to customers by region/currency coverage"],"tags":["cart","shipping","pricing","region"],"backgroundTag":"missing-price-for-context","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}