# API error trying to create return with cancelled items on order

**URL:** <https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443>\
**Category:** GraphQL API\
**Created:** [July 16, 2021, 6:45pm UTC](https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443 "2021-07-16T18:45:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fairweather](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@fairweather](https://community.shiphero.com/u/fairweather)\
**Post date:** [July 16, 2021, 6:45pm UTC](https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443/1 "2021-07-16T18:45:59Z")

</div>

I am trying to create return through the GraphQL API. The only thing different about this order is 2 of the 4 items have been cancelled. When I try and create a return with one of the good items, I get the following error:

{“errors”:[{“message”:“Invalid Line item 534944306, warehouse Primary. It must belong to the same warehouse 11932, [NAME REDADCTED].”,“operation”:“return\_create”,“field”:“return\_create”,“request\_id”:“60f1d1d2513219c080991280”,“code”:9}],“data”:{“return\_create”:null}}

Is this a known bug?

---

<div class="post-metadata">

**Author:** ![Theresa](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/theresa/32/377_2.png) [@Theresa](https://community.shiphero.com/u/Theresa)\
**Post date:** [July 16, 2021, 7:48pm UTC](https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443/2 "2021-07-16T19:48:11Z")

</div>

Hi,  
The line item in our data says that the warehouse (for that line item )is Primary, but that sku does not reside in the Primary warehouse.  
Have you tried the same thing in the UI? Does it give an error?

---

<div class="post-metadata">

**Author:** ![fairweather](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@fairweather](https://community.shiphero.com/u/fairweather)\
**Post date:** [December 10, 2021, 8:40pm UTC](https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443/3 "2021-12-10T20:40:09Z")

</div>

I’m sorry for cross posting but I posted this in another thread. This is specifically what I am seeing:

I am seeing this error in the following situation and would love some advice on how to fix it.

I create an order using the API. My warehouse is set to the ID of my custom warehouse, we’ll call it “custom” for now. I add a new item to that order through the UI. When I try and create a return on the order, the item that was added by hand throws the error: “Invalid Line item ######, warehouse Primary. It must belong to the same warehouse ######, custom”

It seems to me, when I add the new item to the order it is defaulting to Primary instead of what warehouse the order is using. I did not see a place to change this so it would be nice to know a solution.

---

<div class="post-metadata">

**Author:** ![tomasfd](https://avatars.discourse-cdn.com/v4/letter/t/5daacb/32.png) [@tomasfd](https://community.shiphero.com/u/tomasfd)\
**Post date:** [December 13, 2021, 2:04pm UTC](https://community.shiphero.com/t/api-error-trying-to-create-return-with-cancelled-items-on-order/1443/5 "2021-12-13T14:04:38Z")

</div>

Hello @fairweather!  
No problem with that. We will continue on this thread.  
Can you share the request ID of one of the last occurrences of this?  
Have a nice day!  
TomasFD
