GraphQL: Syntax Error: Expected Name, found <EOF> / Unexpected }
The GraphQL document is malformed — unbalanced braces, a stray comma/character, or an empty query.
Syntax Error: Expected Name, found <EOF>Syntax Error: UnexpectedExpected Name, found Meaning
Usually a typo when hand-writing queries, a template literal that didn’t interpolate, or sending JSON where a query string is expected.
Common causes
- Unbalanced braces/parentheses
- Empty query or query not sent as a string
- Invalid characters or string interpolation mistakes
- Fragments referenced but not included
⚡ Quick fix
- Validate the query in GraphiQL/Apollo Sandbox
- Use gql tagged templates / codegen
- Log the exact query string sent
Detailed fix by platform
JavaScript
- javascript
import { gql } from "@apollo/client"; const GET_USER = gql`query GetUser($id: ID!) { user(id: $id) { id name } }`;
How to diagnose
- Query — Exact string sent
- Tooling — Linting/codegen errors
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in API
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026