On this page
Why this happens
The 2026-01 API introduced the replacement field. In 2026-04 the older compareQuantity and ignoreCompareQuantity inputs were removed. The new field must be supplied at runtime even though schema tooling may not mark it required.
How to fix it
Audit ERP and warehouse integrations for inventorySetQuantities payload builders. Decide whether each integration owns the absolute stock value or is applying a relative movement. Use inventoryAdjustQuantities for relative adjustments rather than deriving a stale absolute value. For absolute writes, read the relevant inventory item, location and quantity state, then include the expected value. Handle CHANGE_FROM_QUANTITY_STALE by re-reading and reconciling the upstream event rather than blindly overwriting.
Practical example
If available stock was 40 and your authoritative calculation says 38, a conditional quantity input contains quantity: 38 and changeFromQuantity: 40 alongside inventoryItemId and locationId. If another process changes stock to 39 first, investigate and recompute before submitting again. Explicit null is appropriate only when the source truly owns the absolute quantity.
- Pin the target API version
- use a disposable inventory item at a test location
- read its available quantity
- submit a conditional update
- attempt another with the stale expected quantity
- verify the error and persisted stock
- test explicit null on disposable data
- inspect retry handling and reconcile against the warehouse ledger.

