Shopify API Gem Error when creating custom collection collects.shop_id can't be blank

Shopify Partner
14 0 3

This is the error I'm getting:

--> 422 Unprocessable Entity 88 (193.4ms)
Headers: {"Authorization"=>"Basic YWVlYTAzNDJmNDljYzM1NTNlODU4MGQzMGE3YmY5Zjg6YzVlYzIwZGU3NDU5NTQ3MzRhNTQzZWI5N2RmODRiYmM=", "Content-Type"=>"application/json", "User-Agent"=>"ShopifyAPI/4.3.0 ActiveResource/4.1.0 Ruby/2.3.0"}
{"errors":{"collects.shop_id":["can't be blank"],"collects.product":["can't be blank"]}}

I can't find anything in the API Docs about needing to set a shop_id or a product when creating a custom collection.

Anybody know what's wrong with my request?

Replies 4 (4)
Shopify Staff
Shopify Staff
300 3 79

Hey Kevin,

This is not an API related error rather an issue with the shop. I would recommend contacting the account owner of that shop.


- Jordan

Jordan | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
14 0 3

I am the account owner of the shop. Can you tell me how to resolve the issue?

Shopify Partner
14 0 3

For future reference. This was not an API related error, it was an issue of out of sync data. The product_id I was passing on the API request no longer existed in my store. In my case I was passing a couple hundred product_id's in on creation of the CustomCollection and only a few of them no longer existed. Took some debugging, but if you run into that error message, that's likely your problem.

4 0 3

This means there is a product id in the list of collects that does not exist in the shop anymore.

I wish the error was more clear and told you the product id that should be removed.

Throw the error saying these products dont exist and then list the ids.

Otherwise, the client has to go back and confirm each product id, find the one that does not exist and then resend the request. Sometimes that is 1000s of products in the collection.