{"record":{"id":"6276ec7da322cc30","repo":"medusajs/medusa","slug":"action-associatedaction-id-is-not-adding-a-ship","errorCode":null,"errorMessage":"Action ${associatedAction.id} is not adding a shipping method","messagePattern":"Action (.+?) is not adding a shipping method","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/draft-order/steps/validate-draft-order-shipping-method-action.ts","lineNumber":64,"sourceCode":"export const validateDraftOrderShippingMethodActionStep = createStep(\n  \"validate-draft-order-shipping-method-action\",\n  async function ({\n    input,\n    orderChange,\n  }: ValidateDraftOrderShippingMethodActionStepInput) {\n    const associatedAction = (orderChange.actions ?? []).find(\n      (a) => a.id === input.action_id\n    ) as OrderChangeActionDTO\n\n    if (!associatedAction) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `No shipping method found for order ${input.order_id} in order change ${orderChange.id}`\n      )\n    }\n\n    if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `Action ${associatedAction.id} is not adding a shipping method`\n      )\n    }\n  }\n)\n","sourceCodeStart":46,"sourceCodeEnd":71,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/draft-order/steps/validate-draft-order-shipping-method-action.ts#L46-L71","documentation":"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).","triggerScenarios":"Passing an ITEM_ADD or other non-SHIPPING_ADD action id to a draft-order shipping method action workflow.","commonSituations":"Client routes all action removals through the shipping workflow; stale action list where the action type differs from what the UI assumed.","solutions":["Check action.action === 'SHIPPING_ADD' before calling the shipping action workflow","Route item actions to the item-action workflow","Re-fetch actions and render their types in the UI"],"exampleFix":"// before\nawait deleteDraftOrderShippingMethodWorkflow(container).run({ input: { order_id, action_id } }) // ITEM_ADD action\n\n// after\nif (action.action === \"SHIPPING_ADD\") {\n  await deleteDraftOrderShippingMethodWorkflow(container).run({ input: { order_id, action_id: action.id } })\n} else {\n  await removeItemDraftOrderWorkflow(container).run({ input: { order_id, action_id: action.id } })\n}","handlingStrategy":"type-guard","validationCode":"if (action.action !== \"SHIPPING_ADD\") throw new Error(\"Not a shipping-add action\")","typeGuard":"const isShippingAddAction = (a: { action: string }) => a.action === \"SHIPPING_ADD\"","tryCatchPattern":null,"preventionTips":["Route by action type: item workflows for ITEM_*, shipping workflows for SHIPPING_*"],"tags":["draft-order","shipping-method","action-type"],"backgroundTag":"invalid-order-change-action-type","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}