Bulk query cancelled for certain stores

Hi everyone,

My app currently sends a bulk query to get stores’ product catalog.

It works very well but for some stores it doesn’t.

After several hours, the bulk operation is cancelled. I receive the cancellation webhook but it doesn’t provide any additional information (no error code).

Anyone from Shopify’s Team would be able to give me more information about what’s going on?

Example of a bulk which didn’t work: “gid://shopify/BulkOperation/6652642820246”

{"admin_graphql_api_id":"gid://shopify/BulkOperation/6652642820246","completed_at":null,"created_at":"2025-12-31T07:08:19-06:00","error_code":null,"status":"canceled","type":"query"}

Thanks a lot :folded_hands:

You may want to share a Request ID so the Shopify team can investigate.

Hello Luke,

Which request ID ? When we launch a bulk query we only have the bulk operation ID, there is no request ID if I’m not mistaken

Hello,

Does anyone have some insights about the issue I am facing?

Thank you

Hi @guifo

There’s a couple things you could look into here:

  • For the stores where this is not working are you seeing any similarities? eg: large catalogs or complex object graphs, or unusual/ legacy data that makes resolving your query slower.
  • What other info do you get when you query the bulkOperation? eg: objectCount, fileSize
  • If you remove non‑essential fields from the bulk query and avoid deeply nested or heavy connections, does it run as expected on stores it previously failed on?

Hi @Liam-Shopify

You’ll find the query I use below.

I just tested on a store:

  • If I leave the query as it is, my bulk is getting cancelled.
  • If I remove the “media” part of ProductVariant or of Product, my bulk query works

=> It seems that the retrieval of media leads to the cancellation of my bulk query. But I don’t really know why. Do you have an idea?

Example:

With “media” retrieval only for ProductVariant : :white_check_mark:

{
“data”: {
“currentBulkOperation”: {
“id”: “gid://shopify/BulkOperation/6686242603158”,
“status”: “COMPLETED”,
“errorCode”: null,
“objectCount”: “268608”,
“rootObjectCount”: “16568”
}
}
}

With “media” retrieval only for Product : :white_check_mark:

{
“data”: {
“currentBulkOperation”: {
“id”: “gid://shopify/BulkOperation/6686395039894”,
“status”: “COMPLETED”,
“errorCode”: null,
“objectCount”: “449218”,
“rootObjectCount”: “16568”
}
}
}

With “media” retrieval for both ProductVariant and Product: :cross_mark:

{
“data”: {
“bulkOperation”: {
“id”: “gid://shopify/BulkOperation/6685602545814”,
“status”: “CANCELED”,
“objectCount”: “452952”,
“rootObjectCount”: “16568”,
“fileSize”: null,
“partialDataUrl”: null
}
}
}

mutation Mutation {

      bulkOperationRunQuery(

query: """

          {

            productVariants(query: "product_status:active") {

              edges {

                node {

                  __typename

                  id

                  displayName

                  title

                  price

                  compareAtPrice

                  inventoryQuantity

                  position

                  selectedOptions {

                    name

                    value

                  }

                  media {

                    edges {

                      node {

                        ... on MediaImage {

                          __typename

                          id

                          image {

                            url

                          }

                        }

                      }

                    }

                  }

                  metafields {

                    edges {

                      node {

                        __typename

                        id

                        definition {

                          name

                        }

                        namespace

                        key

                        value

                        reference {

                          __typename

                          ... on Collection {

                            __typename

                            handle

                          }

                          ... on Product {

                            __typename

                            handle

                          }

                          ... on ProductVariant {

                            __typename

                            product {

                              handle

                            }

                          }

                          ... on GenericFile {

                            __typename

                            url

                          }

                          ... on Model3d {

                            __typename

                            originalSource {

                              url

                            }

                          }

                          ... on MediaImage {

                            __typename

                            image {

                              url

                            }

                          }

                          ... on Video {

                            originalSource {

                              url

                            }

                          }

                        }

                      }

                    }

                  }

                  product {

                    id

                    title

                    hasOnlyDefaultVariant

                    description

                    onlineStoreUrl

                    vendor

                    productType

                    category {

                      fullName

                    }

                    featuredMedia {

                      ... on MediaImage {

                        __typename

                        id

                        image {

                          url

                        }

                      }

                    }

                    media {

                      edges {

                        node {

                          ... on MediaImage {

                            __typename

                            id

                            image {

                              url

                            }

                          }

                        }

                      }

                    }

                    metafields {

                      edges {

                        node {

                          __typename

                          id

                          definition {

                            name

                          }

                          key

                          value

                          reference {

                            __typename

                            ... on Collection {

                              __typename

                              handle

                            }

                            ... on Product {

                              __typename

                              handle

                            }

                            ... on ProductVariant {

                              __typename

                              product {

                                handle

                              }

                            }

                            ... on GenericFile {

                              __typename

                              url

                            }

                            ... on Model3d {

                              __typename

                              originalSource {

                                url

                              }

                            }

                            ... on MediaImage {

                              __typename

                              image {

                                url

                              }

                            }

                            ... on Video {

                              originalSource {

                                url

                              }

                            }

                          }

                        }

                      }

                    }

                  }

                }

              }

            }

          }

"""

) {

bulkOperation {

id

fileSize

status

url

objectCount

rootObjectCount

}

userErrors {

field

message

}

}

}

Hi,

Do you have any clue? Is it because it retrieves too much data? I didn’t see such a limitation in bulk query’s documentation.

Thank you

Hi again @guifo

Your mutation itself is valid (I validated a normalized version against the latest Admin schema on my side), so this is not a schema/structure bug—it’s about how heavy the query is in practice on large catalogs.

Bulk operations have strict practical limits: the docs say there’s a maximum of five connections per query, and your query hits that limit (productVariants , plus media/metafields on both the variant and the product). Combined with the depth of metafield references and large data volumes, Shopify’s backend ends up considering the operation “stalled” and automatically cancels it.

That’s why your tests behave the way they do: querying media only on variants works, and querying media only on products works, but querying media on both at once results in status: "CANCELED" with errorCode: null tipping it over.

To make this reliable, you’ll want to split the work into multiple lighter bulk operations rather than one “everything at once” query. A common pattern is: one bulk for core product/variant data (no media), one bulk for product media keyed by product ID, and one bulk for variant media keyed by variant ID. After that you can then join these JSONL outputs in your own processing pipeline.

Hi Liam,

Thanks for your answer.

My query has five connections, but it should be valid as the doc says “Maximum of five total connections in the query.”.

Plus, my query respects the depth mentioned in the documentation “Maximum of two levels deep for nested connections.”.

So I guess it is more a matter of data volume for some stores (my query works for a majority stores), but the documentation doesn’t mention any restriction about data volume.

I’ll try to see if I can split my query in several queries, but it is a non trivial work to do on my side :frowning: .

I understand the frustration here @guifo - it appears you’re hitting a performance/throughput limit, not a schema or structural violation. The bulk engine isn’t rejecting your query upfront; it accepts and runs it.

But for shops where the product catalog + media + metafields + references are very large, the operation progresses so slowly that it’s treated as stalled and auto‑canceled. That’s why it works for the majority of stores but not for the largest/most complex ones, and why you see CANCELED with errorCode: null instead of FAILED with a specific error.

I’ll look into improving the documentation with regard to data volume so devs can easily troubleshoot when they experience similar issues.