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”
}
]