"Variable $id of type ID! was provided invalid value" error with valid Shopify GID in GraphQL API

We’re encountering a persistent issue with the Shopify Admin GraphQL API when trying to query inventory items. The error occurs even though we’re using what appears to be a valid GID format.

Error:

javascript

Copy

Error: Variable $id of type ID! was provided invalid value

**Our Setup:

  • API Version: 2024-07
  • Query:

graphql

query inventoryItem($id: ID!) {
  inventoryItem(id: $id) {
    id
    tracked
    sku
  }
}
  • Sample ID: ‘gid://shopify/InventoryItem/48300333859036’
  • Variables passed: { id: ‘gid://shopify/InventoryItem/48300333859036’ }

What we’ve tried:

  1. Verified GID format is correct
  2. Confirmed inventory items exist in the store
  3. Validated API permissions and access
  4. Double-checked variable passing format

Has anyone encountered this issue before? We’re particularly interested in:

  1. Any specific formatting requirements for ID variables
  2. Common causes of this error
  3. Recommended approaches for handling inventory item queries

Any insights would be greatly appreciated!

Is that the exact variables json you’re passing?

Should be below I think:

{ "id": "gid://shopify/InventoryItem/48300333859036" }