medusajs/medusa · error · Error

Action ${associatedAction.id} is not claiming the item

Error message

Action ${associatedAction.id} is not claiming the item

What it means

Thrown when updating a claim item: the referenced order change action exists but its type is not WRITE_OFF_ITEM (the action type used to claim/write off an item). Only write-off actions can be updated here.

Source

Thrown at packages/core/core-flows/src/order/workflows/claim/update-claim-item.ts:108

      orderClaim,
      input,
    }: UpdateClaimItemValidationStepInput,
    context
  ) {
    throwIfIsCancelled(order, "Order")
    throwIfIsCancelled(orderClaim, "Claim")
    throwIfOrderChangeIsNotActive({ orderChange })

    const associatedAction = (orderChange.actions ?? []).find(
      (a) => a.id === input.action_id
    ) as OrderChangeActionDTO

    if (!associatedAction) {
      throw new Error(
        `No request claim found for claim ${input.claim_id} in order change ${orderChange.id}`
      )
    } else if (associatedAction.action !== ChangeActionType.WRITE_OFF_ITEM) {
      throw new Error(`Action ${associatedAction.id} is not claiming the item`)
    }
  }
)

export const updateClaimItemWorkflowId = "update-claim-item"
/**
 * This workflow updates a claim item, added to the claim from an order item.
 * It's used by the [Update Claim Item Admin API Route](https://docs.medusajs.com/api/admin/claims/update-a-claim-item).
 * 
 * You can use this workflow within your customizations or your own custom workflows, allowing you to update a claim item
 * in your custom flows.
 * 
 * @example
 * const { result } = await updateClaimItemWorkflow(container)
 * .run({
 *   input: {
 *     claim_id: "claim_123",
 *     action_id: "orchact_123",

View on GitHub (pinned to 5e06e544a2)

Solutions

  1. Select an action with action === ChangeActionType.WRITE_OFF_ADD/WRITE_OFF_ITEM from the claim's order change
  2. For outbound added items use updateClaimAddItemWorkflow instead
  3. Validate action type before invoking the workflow

Example fix

// before
await updateClaimItemWorkflow(container).run({
  input: { claim_id, action_id: outboundAction.id },
})

// after
const writeOff = orderChange.actions.find(
  (a) => a.action === ChangeActionType.WRITE_OFF_ITEM
)
if (writeOff) {
  await updateClaimItemWorkflow(container).run({
    input: { claim_id, action_id: writeOff.id, quantity: 2 },
  })
}
Defensive patterns

Strategy: validation

Validate before calling

const action = orderChange.actions?.find((a) => a.id === actionId)
if (action?.action !== ChangeActionType.WRITE_OFF_ITEM) throw new Error('Not a claim-item action')

Type guard

const isWriteOffAction = (a?: OrderChangeActionDTO) =>
  !!a && a.action === ChangeActionType.WRITE_OFF_ITEM

Prevention

When it happens

Trigger: Calling updateClaimItemWorkflow with an action_id whose action !== ChangeActionType.WRITE_OFF_ITEM, e.g. an ITEM_ADD (outbound) or SHIPPING_ADD action.

Common situations: Confusing inbound (write-off) and outbound (add-item) actions when building the update request; admin UI passing the wrong action row.

Related errors


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