Help Needed: 400 Error with "Invariant Failed" on Shopify customerAddressUpdate Mutation

Topic summary

A developer is experiencing a persistent **400 \

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

Hi Shopify Community,

I’m encountering an issue with the Shopify customerAddressUpdate mutation and need your assistance. I receive a 400 error with the message “Invariant Failed” when attempting to update or create an address using the Shopify API.

Here’s a summary of the problem:

  • Mutation Used: customerAddressUpdate

  • Error: 400 Bad Request, “Invariant Failed”

  • Issue: Despite providing the correct payload and ensuring that the mutation fields match Shopify’s API documentation, the error persists.

    Details:

    • GraphQL Mutation Query:
mutation customerAddressUpdate(
  $address: CustomerAddressInput!
  $addressId: ID!
  $defaultAddress: Boolean
) {
  customerAddressUpdate(
    address: $address
    addressId: $addressId
    defaultAddress: $defaultAddress
  ) {
    customerAddress {
      id
      firstName
      lastName
      address1
      city
      province
      country
      zip
    }
    userErrors {
      code
      field
      message
    }
  }
}

Example Payload:

{
  "address": {
    "firstName": "xtz",
    "lastName": "adfsa",
    "company": "compose tech",
    "address1": "55 Garden Place",
    "address2": "Willoughby",
    "city": "Willoughby",
    "province": "New South Wales",
    "country": "AU",
    "zip": "2068",
    "phone": ""
  },
  "addressId": "your-address-id",
  "defaultAddress": false
}

Headers Used in Postman:

  • Content-Type: application/json
  • X-Shopify-Access-Token: your-access-token

Steps Taken:

  1. Verified that the GraphQL mutation and variables are correctly defined.
  2. Checked the format and values of the address data.
  3. Tested the mutation in GraphQL Playground with similar results.

Questions:

  1. Has anyone encountered a similar “Invariant Failed” error with this mutation?
  2. Are there specific requirements or constraints for the address object that might not be immediately obvious?
  3. Any tips on how to better debug or resolve this issue?

I appreciate any guidance or suggestions you can offer. Thank you!

Best regards,
Shilpe Saxena

Hi @Shilpe_Saxena

customerAddressUpdate (shopify.dev)

I noticed that your parameters are not correct.

Hi @Kyle_liu ,

The solution did not resolve the issue. Even after adjusting the query to match the expected fields, I am still encountering the same error message: “Expected customer address to be updated.”