Request ID: 28b6335a-034b-4ba9-ae89-a9ab6abc6a40-1719600236 Issue of productVariantCreate

Topic summary

A user encountered an “Internal error” when attempting to create a product variant using the productVariantCreate mutation in GraphQL API version 2024-04.

Initial Problem:

  • The mutation failed with an internal server error and Request ID: 28b6335a-034b-4ba9-ae89-a9ab6abc6a40-1719600236
  • The product had only a default variant initially, and the user was trying to add a new variant with size option “S”

Solution Identified:

Remaining Issue:

  • Removing the problematic element allowed variant creation to succeed
  • However, the user now receives an error stating that option “S” already exists, even though that’s the intended behavior
  • The discussion remains open regarding how to properly handle the existing option scenario
Summarized with AI on November 8. AI used: claude-sonnet-4-5-20250929.

Hi there,

I have an issue with productVariantCreate (GraphiQL version 2024-04), please see below for the mutation, variable and response.

Thank you,

The mutation:

mutation productVariantCreate ($input: ProductVariantInput!) {
productVariantCreate(input: $input) {
product {
id
}
productVariant {
id
barcode
sku
inventoryItem {
id
}
}
userErrors {
field
message
}
}
}

The variables:

{
“input”: {
“barcode”: “Super.0403M-1605N//000S.HDCL”,
“options”: [ “S” ],
“position”: 1,
“price”: “89.99”,
“productId”: “gid://shopify/Product/7991957979306”,
“compareAtPrice”: “89.99”,
“inventoryItem”: {
“cost”: null,
“measurement”: null,
“tracked”: true
},
“taxable”: true,
“inventoryQuantities”: [
{
“locationId”: “gid://shopify/Location/60269330602”,
“availableQuantity”: 0
}
]
}
}

But I got this error

response error: - Internal error. Looks like something went wrong on our end.
Request ID: 28b6335a-034b-4ba9-ae89-a9ab6abc6a40-1719600236 (include this in support requests).

This is the product

{
“data”: {
“product”: {
“description”: “”,
“descriptionHtml”: “”,
“hasOnlyDefaultVariant”: true,
“id”: “gid://shopify/Product/7991957979306”,
“options”: [
{
“id”: “gid://shopify/ProductOption/10186974494890”,
“name”: “Title”,
“values”: [
“Default Title”
],
“position”: 1
}
],
“productType”: “95”,
“publishedAt”: null,
“status”: “DRAFT”,
“tags”: ,
“title”: “0403M-1605N”,
“variants”: {
“pageInfo”: {
“hasNextPage”: false
},
“edges”: [
{
“cursor”: “eyJsYXN0X2lkIjo0NjExMTIxMjc5ODEyMiwibGFzdF92YWx1ZSI6IjEifQ==”,
“node”: {
“availableForSale”: true,
“barcode”: null,
“compareAtPrice”: null,
“createdAt”: “2024-06-28T18:45:50Z”,
“displayName”: “0403M-1605N - Default Title”,
“id”: “gid://shopify/ProductVariant/46111212798122”,
“inventoryItem”: {
“id”: “gid://shopify/InventoryItem/48141377339562”,
“inventoryLevels”: {
“edges”: [
{
“node”: {
“quantities”: [
{
“quantity”: 0
}
],
“id”: “gid://shopify/InventoryLevel/94498226346?inventory_item_id=48141377339562”
}
}
]
},
“tracked”: false,
“unitCost”: null,
“measurement”: {
“weight”: {
“value”: 0,
“unit”: “KILOGRAMS”
}
}
},
“position”: 1,
“price”: “0.00”,
“selectedOptions”: [
{
“name”: “Title”,
“value”: “Default Title”
}
],
“sku”: “”,
“taxable”: true,
“title”: “Default Title”,
“updatedAt”: “2024-06-28T18:45:50Z”
}
}
]
},
“vendor”: “Harley-Davidson Canada”
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 31,
“actualQueryCost”: 13,
“throttleStatus”: {
“maximumAvailable”: 2000,
“currentlyAvailable”: 1987,
“restoreRate”: 100
}
}
}
}

I know it is a single variant product. But before add variant I did add options, as below:

mutation:

mutation createOptions ($productId: ID!, $options: [OptionCreateInput!]!) { productOptionsCreate (productId: $productId, options: $options) { product { id variants (first:10) { nodes { id barcode sku inventoryItem { id } } } options { id name values position optionValues { id name hasVariants } } } userErrors { field message } } }

variable:

{“productId”:“gid://shopify/Product/7991957979306”,“options”:[{“name”:“Taille”,“values”:[{“name”:“S”},{“name”:“XS”},{“name”:“XL”}]}]}

Hey bro
sku deprecated you need to use inventoryItem.sku

and you can look up the docs here

It seems working if I remove the element below from the variable. But even though the variant was created, it still gave me an error like ‘S’ already exists. Of course ‘S’ exists and that’s what I want.

“measurement”: null,