See how we built our intranet. Live + Q&A, June 30 →

Intermittent 400 "expected ')'" errors on 10-30% of GraphQL calls to Sanity

7 repliesLast updated: Dec 2, 2025

👋 Hey folks! Wanted to echo this issue , which for us is affecting roughly 10-30% of all GQL calls to Sanity. I've tested sending the same payload over and over, with the same intermittent results - so I can verify it's not a difference in the data we're sending or how we're sending it. This points to it being an issue on Sanitys side, where occasionally we'll get
expected ')' following parenthesized expression
as a response with a
400
code. While we aggressively cache, this has the potential for breaking our frontend which heavily relies on Sanity.
I do see that Sanitys status page is all green, but this seems like a fairly serious issue if it is on their side like I suspect.
🤔
AI Update

I understand this is frustrating - intermittent failures with identical payloads are definitely concerning. However, before assuming this is a Sanity infrastructure issue, let's work through some troubleshooting steps since the "expected ')' following parenthesized expression" error typically indicates a GraphQL syntax problem.

What this error usually means

This error message is a GraphQL syntax error - it means the GraphQL parser encountered malformed syntax, typically an unclosed parenthesis or incorrect query structure. While you mention sending "the same payload over and over," there could be factors causing variation in what actually reaches Sanity's servers.

Troubleshooting steps

Inspect the actual requests being sent - Even if your code appears to send identical payloads, check:

Check for variable serialization issues - GraphQL variables that aren't properly serialized can cause intermittent syntax errors:

// Bad - might create syntax issues
const variables = { filter: `name == "${userInput}"` }

// Good - properly structured
const variables = { filter: { name: { eq: userInput } } }

Examine your GraphQL query structure - Common syntax issues include:

Test with a minimal query - Strip your query down to the simplest possible version and gradually add complexity to isolate where the issue occurs.

Why intermittent failures happen

Even with "identical" payloads, intermittent failures can occur due to:

Next steps

Contact Sanity support with specific details:

Provide them with the raw request body from both successful and failed attempts if you can capture them.

Consider using GROQ temporarily - If this is blocking production, Sanity's native GROQ query language provides an alternative way to query the Content Lake. Note that GROQ and GraphQL are different query interfaces with different syntax and capabilities, so this would require rewriting queries rather than being a drop-in replacement.

Implement retry logic - While investigating, add retry logic for 400 errors as a defensive measure, though this treats the symptom rather than the cause.

The status page showing green doesn't necessarily mean there isn't an issue, but the specific error message you're seeing strongly suggests a query syntax problem rather than general infrastructure issues. Sanity's support team will have access to server-side logs that can definitively show whether the queries arriving at their servers are malformed or if there's something else happening.

Show original thread
7 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions