Hi all,
I’ve run into an odd issue when using the productSet
mutation with images and duplicateResolutionMode: REPLACE
.
The first time I run the mutation, everything works fine — the product is created and the images show up as expected:
The second time I run the exact same mutation, the same product stays/updates but the images disappear:
The third time, the images come back:
(Shopify dev community forum has a limit of up to 5 images that can be attached to a post, so you can view the other 2 images at the links below)
GraphQL Query RUN #3 - files reappear
https://cdn.shopify.com/s/files/1/0878/3799/9398/files/Screenshot_2025-05-01_at_9.12.41_AM.png?v=1746107020
GraphQL Query RUN #3 - main product image reappears
https://cdn.shopify.com/s/files/1/0878/3799/9398/files/Screenshot_2025-05-01_at_9.12.24_AM.png?v=1746107020
This keeps repeating — images show up on odd runs, disappear on even runs.
Here is the GraphQL query that was used:
Query
mutation createProductWMedia($identifier: ProductSetIdentifiers!, $productSet: ProductSetInput!, $synchronous: Boolean!) {
productSet(
identifier: $identifier
synchronous: $synchronous
input: $productSet
) {
product {
title
id
US: publishedInContext(context: {country: US})
CA: publishedInContext(context: {country: CA})
AU: publishedInContext(context: {country: AU})
}
productSetOperation {
id
status
userErrors {
code
field
message
}
}
userErrors {
code
field
message
}
}
}
Variables:
{
"identifier": {
"customId": {
"namespace": "custom",
"key": "external_system_id",
"value": "1000000001-CAMERA"
}
},
"synchronous": true,
"productSet": {
"descriptionHtml": "",
"title": "Cool New Camera",
"handle": "cool-new-camera",
"files": [
{
"filename": "black-camera.jpg",
"contentType": "IMAGE",
"alt": "Black camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/black-camera.jpg"
},
{
"filename": "blue-camera.jpg",
"contentType": "IMAGE",
"alt": "Blue camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/blue-camera.jpg"
}
],
"productOptions": [
{
"name": "Color",
"values": [
{
"name": "Black"
},
{
"name": "Blue"
}
]
}
],
"variants": [
{
"optionValues": [
{
"optionName": "Color",
"name": "Black"
}
],
"sku": "GTS-002",
"file": {
"filename": "black-camera.jpg",
"contentType": "IMAGE",
"alt": "Black camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/black-camera.jpg"
}
},
{
"optionValues": [
{
"optionName": "Color",
"name": "Blue"
}
],
"sku": "GTS-777",
"file": {
"filename": "blue-camera.jpg",
"contentType": "IMAGE",
"alt": "Blue camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/blue-camera.jpg"
}
}
]
}
}
Response:
{
"data": {
"productSet": {
"product": {
"title": "Cool New Camera",
"id": "gid://shopify/Product/10106483638566",
"US": true,
"CA": true,
"AU": true
},
"productSetOperation": null,
"userErrors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 51,
"actualQueryCost": 50,
"throttleStatus": {
"maximumAvailable": 20000,
"currentlyAvailable": 19950,
"restoreRate": 1000
}
}
}
}
Furthermore, there is another strange issue. When you view the product details for that product in Shopify admin, the product still shows a grayed-out media thumbnail that looks like it’s trying to reference images—but nothing can be clicked. It appears the media is left in an incomplete or broken state:
Some extra details:
- To avoid any cyclic dependency of image references, I’m using public image URLs hosted on a different Shopify store, not the one where I ran the above mutation on. I also tried images hosted somewhere else other than Shopify and noticed the same issue.
- I made sure the filenames are clean and simple:
black-camera.jpg
andblue-camera.jpg
. - No special characters, weird formatting, or anything like that.
- In an attempt to isolate the issue, when I use the
fileCreate
mutation instead, everything works consistently — the images are always replaced as expected, no matter how many times I run the GraphQL query like below:
Query:
mutation fileCreate($files: [FileCreateInput!]!) {
fileCreate(files: $files) {
files {
id
fileStatus
alt
createdAt
}
userErrors {
code
message
}
}
}
Variables:
{
"files": [
{
"filename": "black-camera.jpg",
"contentType": "IMAGE",
"alt": "Black camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/black-camera.jpg"
},
{
"filename": "blue-camera.jpg",
"contentType": "IMAGE",
"alt": "Blue camera",
"duplicateResolutionMode": "REPLACE",
"originalSource": "https://cdn.shopify.com/s/files/1/0716/7279/1289/files/blue-camera.jpg"
}
]
}
Result:
{
"data": {
"fileCreate": {
"files": [
{
"id": "gid://shopify/MediaImage/42177687716134",
"fileStatus": "READY",
"alt": "Black camera",
"createdAt": "2025-05-01T13:12:11Z"
},
{
"id": "gid://shopify/MediaImage/42177687748902",
"fileStatus": "READY",
"alt": "Blue camera",
"createdAt": "2025-05-01T13:12:11Z"
}
],
"userErrors": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 20,
"actualQueryCost": 20,
"throttleStatus": {
"maximumAvailable": 20000,
"currentlyAvailable": 19980,
"restoreRate": 1000
}
}
}
}
So this issue appears to be isolated to the productSet
mutation. Would someone from Shopify Staff please take a look and let me know?
Thank you for your time!