{"record":{"id":"998cfc72fce74211","repo":"medusajs/medusa","slug":"action-associatedaction-id-is-not-adding-a-ship-998cfc","errorCode":null,"errorMessage":"Action ${associatedAction.id} is not adding a shipping method","messagePattern":"Action (.+?) is not adding a shipping method","errorType":"validation","errorClass":"Error","httpStatus":500,"severity":"error","filePath":"packages/core/core-flows/src/order/workflows/claim/remove-claim-shipping-method.ts","lineNumber":91,"sourceCode":"  \"validate-remove-claim-shipping-method\",\n  async function ({\n    orderChange,\n    orderClaim,\n    input,\n  }: RemoveClaimShippingMethodValidationStepInput) {\n    throwIfIsCancelled(orderClaim, \"Claim\")\n    throwIfOrderChangeIsNotActive({ orderChange })\n\n    const associatedAction = (orderChange.actions ?? []).find(\n      (a) => a.id === input.action_id\n    ) as OrderChangeActionDTO\n\n    if (!associatedAction) {\n      throw new Error(\n        `No shipping method found for claim ${input.claim_id} in order change ${orderChange.id}`\n      )\n    } else if (associatedAction.action !== ChangeActionType.SHIPPING_ADD) {\n      throw new Error(\n        `Action ${associatedAction.id} is not adding a shipping method`\n      )\n    }\n  }\n)\n\nexport const removeClaimShippingMethodWorkflowId =\n  \"remove-claim-shipping-method\"\n/**\n * This workflow removes an inbound (return) or outbound (delivery of new items) shipping method of a claim.\n * It's used by the [Remove Inbound Shipping Method](https://docs.medusajs.com/api/admin/claims/remove-inbound-shipping-method),\n * or [Remove Outbound Shipping Method](https://docs.medusajs.com/api/admin/claims/remove-outbound-shipping-method) Admin API Routes.\n * \n * You can use this workflow within your customizations or your own custom workflows, allowing you to remove shipping methods from a claim\n * in your own custom flows.\n * \n * @example\n * const { result } = await removeClaimShippingMethodWorkflow(container)","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/order/workflows/claim/remove-claim-shipping-method.ts#L73-L109","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the action_id comes from the output of createClaimShippingMethodWorkflow (a SHIPPING_ADD action)","Before calling, fetch the order change action and confirm its `action` field equals 'SHIPPING_ADD'","If the shipping method was added by a different mechanism, use the workflow matching that action type instead"],"exampleFix":"// before\nawait updateClaimShippingMethodWorkflow(container).run({\n  input: { claim_id, action_id: itemAction.id }, // wrong action\n})\n\n// after\nconst action = orderChange.actions.find((a) => a.id === actionId)\nif (action?.action === ChangeActionType.SHIPPING_ADD) {\n  await updateClaimShippingMethodWorkflow(container).run({\n    input: { claim_id, action_id: action.id },\n  })\n}","handlingStrategy":"validation","validationCode":"const action = orderChange.actions?.find((a) => a.id === actionId)\nif (!action || action.action !== ChangeActionType.SHIPPING_ADD) {\n  throw new Error(`Invalid action: ${actionId}`)\n}","typeGuard":"const isShippingAddAction = (\n  a?: OrderChangeActionDTO\n): a is OrderChangeActionDTO & { action: 'SHIPPING_ADD' } =>\n  !!a && a.action === ChangeActionType.SHIPPING_ADD","tryCatchPattern":null,"preventionTips":["Always source action_id from the create-shipping-method step output","Filter order change actions by action type before building update payloads"],"tags":["order","claim","shipping-method","validation"],"backgroundTag":"invalid-order-change-action-type","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}