Put theme asset returns error or warning "Cannot overwrite generated asset 'assets/theme.scss'"

jingram
Visitor
3 0 0

Hi there. When using the REST API to put an asset, there appears to be flakiness in this call. Sometimes we receive this error response:

{"errors":{"asset":["Cannot overwrite generated asset 'assets\/theme.scss'."]}}

The HTTP code returned is: 422 Unprocessable Entity.

Here's a part of the request:

PUT: https://<redacted>.myshopify.com/admin/api/2021-04/themes/127616155819/assets.json
SENT: {"asset":{"attachment":"","content_type":"","key":"assets/theme.scss","public_url":"","size":0,"source_key":"","src":"","theme_id":0,"value":" ...

And then sometimes the put is fine. I've noticed when the put is fine, the message is returned in a "warnings" array, not "errors". It seems weird that sometimes it's a non-fatal warning and sometimes it's a fatal error.

I won't attach the whole request/response, but here's a snippet of the response when it's a warning. You can see the warnings are augmented with the successful response:

... "content_type":"text\/css","size":132652,"checksum":"cfcbe8f73d04f93117fb0981c3ed3e68","theme_id":127593021611,"warnings":["Cannot overwrite generated asset 'assets\/theme.scss'."]}}

 Any ideas why it works sometimes and why it errors sometimes? This causes flakiness in our clone theme process due to the put failing randomly.

Thanks in advance,

Jon

Replies 3 (3)

GrahamS
Shopify Staff (Retired)
193 36 53

Hey @jingram ,

Can you pass me an x-request-id from a call that worked, and from one that did not? I can take a look and compare them to see what might be happening here.

Best,

To learn more visit the Shopify Help Center or the Community Blog.

jingram
Visitor
3 0 0

Thanks for the reply @GrahamS.

----

For a successful put (200 OK) here is an example X-Request-Id: ddd2374e-f0cb-454a-acc1-d1fa2e3e3f19

Partial response associated with this request:

... "warnings":["Cannot overwrite generated asset 'assets\/theme.scss'."]}}

----

For a failed put (422 Unprocessable Entity) here is an example X-Request-Id: 10d5baea-7588-4230-ade8-21d4a2c39e5a

Entire response associated with this request:

{"errors":{"asset":["Cannot overwrite generated asset 'assets\/theme.scss'."]}}

 Let me know if there's any more info I can provide. Thanks again.

jingram
Visitor
3 0 0

Hey @GrahamS were you able to follow up on this? Thanks.