{"record":{"id":"9b8b21de6745163c","repo":"medusajs/medusa","slug":"no-request-to-add-item-for-order-input-order-id","errorCode":null,"errorMessage":"No request to add item for order ${input.order_id} in order change ${orderChange.id}","messagePattern":"No request to add item for order (.+?) in order change (.+?)","errorType":"exception","errorClass":"MedusaError","httpStatus":400,"severity":"error","filePath":"packages/core/core-flows/src/draft-order/steps/validate-draft-order-update-action-item.ts","lineNumber":55,"sourceCode":" *   },\n *   orderChange: {\n *     id: \"orch_123\",\n *     // other order change details...\n *   }\n * })\n */\nexport const validateDraftOrderUpdateActionItemStep = createStep(\n  \"validate-draft-order-update-action-item\",\n  async function ({\n    input,\n    orderChange,\n  }: ValidateDraftOrderUpdateActionItemStepInput) {\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 request to add item for order ${input.order_id} in order change ${orderChange.id}`\n      )\n    }\n\n    if (associatedAction.action !== ChangeActionType.ITEM_ADD) {\n      throw new MedusaError(\n        MedusaError.Types.INVALID_DATA,\n        `Action ${associatedAction.id} is not adding an item`\n      )\n    }\n  }\n)\n","sourceCodeStart":37,"sourceCodeEnd":69,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/core-flows/src/draft-order/steps/validate-draft-order-update-action-item.ts#L37-L69","documentation":"validateDraftOrderUpdateActionItemStep requires the given action_id to exist among the order change's actions; thrown when trying to update a draft-order add-item request whose action no longer exists on the change.","triggerScenarios":"Calling updateDraftOrderUpdateItemActionWorkflow (edit a pending 'add item' request) with an action_id absent from the current order change.","commonSituations":"Draft order confirmed so pending actions cleared; stale action id in the client; concurrent admin edits.","solutions":["Re-fetch the pending order change and its ITEM_ADD actions; use a valid id","Ensure the draft order is still in a pending/unconfirmed change state","Refresh the client after confirmations"],"exampleFix":"// before\nawait updateDraftOrderUpdateItemActionWorkflow(container).run({ input: { order_id, action_id: staleId, data: { quantity: 3 } } })\n\n// after\nconst action = pendingChange.actions.find((a) => a.id === wantedId && a.action === \"ITEM_ADD\")\nif (action) {\n  await updateDraftOrderUpdateItemActionWorkflow(container).run({ input: { order_id, action_id: action.id, data: { quantity: 3 } } })\n}","handlingStrategy":"validation","validationCode":"const changes = await query.graph({ entity: \"order_change\", filters: { order_id }, fields: [\"actions.id\", \"actions.action\"] })\nconst action = changes.data[0]?.actions.find((a) => a.id === action_id && a.action === \"ITEM_ADD\")\nif (!action) throw new Error(\"Stale action\")","typeGuard":null,"tryCatchPattern":"try { await workflow(scope).run({ input }) } catch (e) { if (/No request to add item/.test(e.message)) { /* refetch and reselect action */ } throw e }","preventionTips":["Refetch pending add-item actions before editing their quantity"],"tags":["draft-order","order-change","action","not-found"],"backgroundTag":"order-change-action-not-found","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}