productVariantUpdate mutation fail with internal error

Topic summary

Issue: A productVariantUpdate GraphQL mutation in Shopify started returning an INTERNAL_SERVER_ERROR, despite previously working. The mutation attempted to update a product variant’s price, compareAtPrice, inventoryItem (cost, tracked), and included “metafields”: null. The error included a request ID for support.

Key detail: ProductVariantInput is the input type for updating variant fields; “metafields” represents custom key-value data attached to a resource. Passing null for an optional field can cause unexpected behavior.

Guidance: Shopify support noted that metafields is not a required field on ProductVariantInput and suggested removing “metafields”: null. If the goal is to delete actual metafields, they recommended using the separate metafieldDelete mutation instead.

Outcome: Removing the “metafields”: null field resolved the error, and the mutation succeeded. No further changes were required.

Status: Resolved. Actionable takeaway—omit optional fields rather than sending null, and use metafieldDelete when intending to remove metafields.

Summarized with AI on January 1. AI used: gpt-5.

Hi All
I’ve this simple mutation

mutation productVariantUpdate($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
userErrors {
field
message
}
}
}

{
  "input": {
    "id": "gid://shopify/ProductVariant/48122871087427",
    "price": 3.465,
    "compareAtPrice": 0,
    "inventoryItem": {
      "cost": 2.6,
      "tracked": true
    },
    "metafields": null
  }
}

I’ve tryed this mutation many times and always was good, this mutaion is part of my software to update price and cost, but today it fail.

That fail with this error:

{
  "errors": [
    {
      "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 4a5fe55c-28f3-42c1-a988-75bad99ae434-1711723233 (include this in support requests).",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "requestId": "4a5fe55c-28f3-42c1-a988-75bad99ae434-1711723233"
      }
    }
  ]
}

I can’t understand WHY!!!

Hey @CarloB ,

Metafields isn’t a required field on ProductVariantInput. Can you try removing the “metafields”: null to see if it resolves the issue?

If you are trying to delete actual metafields on a productVariant there’s a separate metafieldDelete mutation that you can use.

Hope that helps!

  • James

YEEES…It’s work

1 Like