Getting INTERNAL_SERVER_ERROR from bulk operation status check

For few of our onboarded stores, whenever we try to sync a segment where the query starts with shopify_email.<opened/clicked/…>, the bulk operation fails with the following error:

“status”: “FAILED”,
“errorCode”: “INTERNAL_SERVER_ERROR”
Other segments (not using shopify_email.*) work fine, and the app has read_customers scope.

Sample query:
“query”: “shopify_email.opened MATCHES (\n count = 1\n)”,
Sample GraphQL mutation:
mutation {
bulkOperationRunQuery(query: “{customerSegmentMembers(segmentId:"gid://shopify/Segment/427284725818"){edges{node{id}}}}”) {
bulkOperation { id status }
userErrors { field message }
}
}
Please help us understand why all shopify_email.* queries are consistently failing.

details
we are saas platform for shopify stores
we fetch segments from shopify of a store and show them in our system
for a store (public app) we are not able to sync shopify segment

api curl to start the sync operation
curl -X POST “https://XXXX.myshopify.com/admin/api/2023-07/graphql.json
-H “X-Shopify-Access-Token: XXXXX”
-H “Content-Type: application/json”
-d ‘{
“query”: “mutation {\n bulkOperationRunQuery(\n query: """\n {\n customerSegmentMembers(segmentId: "gid://shopify/Segment/427284791354") {\n edges {\n node {\n id\n }\n }\n }\n }\n """\n ) {\n bulkOperation {\n id\n status\n }\n userErrors {\n field\n message\n }\n }\n }”,
“variables”: {
“cursor”: null
}
}’

responseJson {
“data”: {
“bulkOperationRunQuery”: {
“bulkOperation”: {
“id”: “gid://shopify/BulkOperation/4437523267642”,
“status”: “CREATED”
},
“userErrors”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 10,
“actualQueryCost”: 10,
“throttleStatus”: {
“maximumAvailable”: 4000,
“currentlyAvailable”: 3990,
“restoreRate”: 200
}
}
}
}

but everytime we are getting internal server error when checking the sync status from shopify api

api for sycn status check
curl -X POST “https://XXXX.myshopify.com/admin/api/2023-07/graphql.json
-H “X-Shopify-Access-Token: XXXX”
-H “Content-Type: application/json”
-d ‘{
“query”: “query { node(id: "gid://shopify/BulkOperation/4437523267642") { … on BulkOperation { id status errorCode createdAt completedAt objectCount fileSize url partialDataUrl } } }”,
“variables”: {
“cursor”: null
}
}’

responseJson {
“data”: {
“node”: {
“id”: “gid://shopify/BulkOperation/4437523267642”,
“status”: “FAILED”,
“errorCode”: “INTERNAL_SERVER_ERROR”,
“createdAt”: “2025-07-24T14:27:01Z”,
“completedAt”: null,
“objectCount”: “0”,
“fileSize”: null,
“url”: null,
“partialDataUrl”: null
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 1,
“actualQueryCost”: 1,
“throttleStatus”: {
“maximumAvailable”: 4000,
“currentlyAvailable”: 3999,
“restoreRate”: 200
}
}
}
}

shopify access scope of this store that we have
[
{
“handle”: “read_customer_events”
},
{
“handle”: “read_products”
},
{
“handle”: “read_themes”
},
{
“handle”: “write_customers”
},
{
“handle”: “write_discounts”
},
{
“handle”: “write_draft_orders”
},
{
“handle”: “write_orders”
},
{
“handle”: “write_pixels”
},
{
“handle”: “write_price_rules”
},
{
“handle”: “read_all_orders”
},
{
“handle”: “read_content”
},
{
“handle”: “unauthenticated_read_content”
},
{
“handle”: “unauthenticated_read_customer_tags”
},
{
“handle”: “unauthenticated_read_product_tags”
},
{
“handle”: “unauthenticated_read_product_listings”
},
{
“handle”: “unauthenticated_write_checkouts”
},
{
“handle”: “unauthenticated_write_customers”
},
{
“handle”: “write_marketing_events”
},
{
“handle”: “read_customers”
},
{
“handle”: “read_discounts”
},
{
“handle”: “read_draft_orders”
},
{
“handle”: “read_orders”
},
{
“handle”: “read_pixels”
},
{
“handle”: “read_price_rules”
},
{
“handle”: “unauthenticated_read_checkouts”
},
{
“handle”: “unauthenticated_read_customers”
},
{
“handle”: “read_marketing_events”
}
]

1 Like

Hey @Amrit_Sharma

I ran some tests on different segment types with bulk operations, including specifically creating and testing a shopify_email.* segment.

I was able to create and successfully run bulk operations on multiple segment types, including a segment with shopify_email.opened NOT MATCHES syntax. Both the direct query and bulk operation completed successfully.

Since I couldn’t replicate the exact failure you’re experiencing, there might be something specific about your segment query or store setup causing this.

Do you happen to have the request ID from the headers when you created the bulk operation that’s failing? That would help us potentially identify what’s causing the internal server error for your specific case.

Hey Kyle,
How can I get the requestId?
I did not get any requestId in the response.

api curl to start the sync operation
curl -X POST “https://XXXX.myshopify.com/admin/api/2023-07/graphql.json
-H “X-Shopify-Access-Token: XXXXX”
-H “Content-Type: application/json”
-d ‘{
“query”: “mutation {\n bulkOperationRunQuery(\n query: “”“\n {\n customerSegmentMembers(segmentId: “gid://shopify/Segment/427284791354”) {\n edges {\n node {\n id\n }\n }\n }\n }\n “””\n ) {\n bulkOperation {\n id\n status\n }\n userErrors {\n field\n message\n }\n }\n }”,
“variables”: {
“cursor”: null
}
}’

responseJson {
“data”: {
“bulkOperationRunQuery”: {
“bulkOperation”: {
“id”: “gid://shopify/BulkOperation/4437523267642”,
“status”: “CREATED”
},
“userErrors”:
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 10,
“actualQueryCost”: 10,
“throttleStatus”: {
“maximumAvailable”: 4000,
“currentlyAvailable”: 3990,
“restoreRate”: 200
}
}
}
}

api for sycn status check
curl -X POST “https://XXXX.myshopify.com/admin/api/2023-07/graphql.json
-H “X-Shopify-Access-Token: XXXX”
-H “Content-Type: application/json”
-d ‘{
“query”: “query { node(id: “gid://shopify/BulkOperation/4437523267642”) { … on BulkOperation { id status errorCode createdAt completedAt objectCount fileSize url partialDataUrl } } }”,
“variables”: {
“cursor”: null
}
}’

responseJson {
“data”: {
“node”: {
“id”: “gid://shopify/BulkOperation/4437523267642”,
“status”: “FAILED”,
“errorCode”: “INTERNAL_SERVER_ERROR”,
“createdAt”: “2025-07-24T14:27:01Z”,
“completedAt”: null,
“objectCount”: “0”,
“fileSize”: null,
“url”: null,
“partialDataUrl”: null
}
},
“extensions”: {
“cost”: {
“requestedQueryCost”: 1,
“actualQueryCost”: 1,
“throttleStatus”: {
“maximumAvailable”: 4000,
“currentlyAvailable”: 3999,
“restoreRate”: 200
}
}
}
}

Hey @Amrit_Sharma,

You can get the x-request-id from the API response headers. Screenshot in this thread on what it looks like in Postman

With that said, if this is happening on a single shop, reaching out to our support teams directly will ensure we have access to those specific segments to investigate further.

Hey! Were you able to resolve this with our support teams?