Steps
"Using variables failed": the variables are not valid JSON
The Variables field must hold valid JSON. Single quotes,
{'id': 5}, failed withUsing variables failed ... Expected property name or '}' in JSON at position 1. An expression without quotes,{"name": {{ $json.name }} }, failed withUnexpected token 'A'because the text value landed in the JSON bare. Quoting it,"{{ $json.name }}", worked until a value contained a double quote, then failed withExpected ',' or '}' after property value. What worked every time:{{ JSON.stringify({ name: $json.name }) }}, or an object expression like{{ { name: $json.name, id: $json.id } }}. See n8n expression errors.Variables are silently not sent: GET and Raw format
With Request Method GET, n8n put the query in
?query=and did not send the variables you typed, with no warning. With Request Format GraphQL (Raw), the body was only the query text and the variables were dropped. Version 1 of the node defaults to Raw, so older workflows can lose variables without any error; version 1.1 defaults to JSON. Use POST and Request Format JSON. Overriding the Content-Type header toapplication/jsonon Raw format does not fix it: the body went out as a JSON string, not an object.GraphQL errors fail the node, even with partial data
When the server replied with an
errorsarray, on HTTP 200 or 400, the node failed with the first message, for exampleCannot query field "foo" on type "Query".A plain string inerrorsbecame the message too (Rate limit exceeded). When the reply had partialdatapluserrors, the node still failed and the partial data was lost. With On Error set to Continue (regular output) it went green but produced two items: the full response and{"error": "..."}. Filter on$json.errorafterwards, or downstream nodes run twice. One failing item also stopped every item: 3 inputs with an error on the second gave no output at all.A 401 or 404 shows up as a green success
The GraphQL node does not fail on HTTP status codes when the reply is JSON. A 401 with
{"message":"Bad credentials"}came out green as the output item, and so did a 404. A token sent without theBearerprefix gave exactly that green 401; addingBearerreturned the data. Add an IF or Filter after the node that checks$json.dataexists, and see n8n HTTP Request errors for 401 and 403 causes."Response body is not valid JSON. Change Response Format to String"
When the server answered with an HTML error page or plain text, for example a login page on 401 or a proxy's 500, the node failed with
Response body is not valid JSON. Change "Response Format" to "String", which hides the real status. Set Response Format to String: the run went green and the raw body showed up in the fielddata(or the field you set in Put Output In Field), so you can read what the server really said.One item with a list instead of one item per result
A reply with
data.usersholding 3 users came out as one item with the array inside, so the next node ran once. Add a Split Out node ondata.usersto get one item per user; see n8n Split Out not working. Only a reply that is a top-level JSON array was split into items automatically. The node also runs once per input item: 3 items sent 3 requests, each with its own variables. For cursor pagination, see n8n pagination not working (not tested with the GraphQL node).Connection refused and required fields
With the server down, the node failed with
The service refused the connection - perhaps it is offline. With Endpoint or Query empty, the workflow did not start at all:Parameter "Endpoint" is required.orParameter "Query" is required.
What we ran
On 25 October 2026 we ran 34 executions of the GraphQL node (v1.1, one run on v1) on self-hosted n8n 2.43.7 with n8n execute. The endpoint was a local mock GraphQL server we wrote, which recorded exactly what n8n sent and returned fixed GraphQL-shaped replies. So what n8n sends and how it handles each reply is real, but the replies are our test fixtures, not GitHub, Shopify or another real API. Fixes marked "not tested" are suggestions we did not run.
| What we ran | What happened |
|---|---|
Variables with single quotes {'id': 5} | Fail: Using variables failed ... Expected property name or '}' in JSON at position 1 |
Variables {"name": {{ $json.name }} }, text value | Fail: Using variables failed ... Unexpected token 'A' |
Variables {"name": "{{ $json.name }}" } | OK |
| Same, value contains a double quote | Fail: Expected ',' or '}' after property value |
Variables {{ JSON.stringify({ name: $json.name }) }} | OK, quote escaped |
Variables as an object expression {{ { name: $json.name, id: $json.id } }} | OK |
| Variables empty | OK, sent "variables": {}, "operationName": null |
| Operation Name set | Sent only when set |
| Request Method GET | Query in ?query=, variables NOT sent |
| Request Format GraphQL (Raw) | Body is the query text only, variables dropped |
| Node v1 with default settings | Raw format, variables dropped |
| Raw format + header Content-Type: application/json | Body sent as a JSON string, not an object |
Server replies 200 with errors | Fail: first error message, e.g. Cannot query field "foo" on type "Query". |
Server replies 400 with errors | Fail, same message |
errors is a plain string | Fail: Rate limit exceeded |
Partial data plus errors | Fail, partial data not kept |
| Same with On Error = Continue | Green, 2 items: full response and {"error": "..."} |
| 3 items, the 2nd gets errors | Execution error, no output for any item |
HTTP 401 JSON {"message":"Bad credentials"} | Green, that JSON is the output |
Token without Bearer | Green 401 output |
Token with Bearer | Green, real data |
| HTTP 404 JSON | Green {"message":"not found"} |
| HTML 401 page | Fail: Response body is not valid JSON. Change "Response Format" to "String" |
| Text 500 reply | Fail, same message |
| Either one with Response Format String | Green, body in field data |
Reply data.users with 3 users | One item holding the array |
| Reply is a top-level JSON array | One item per element |
| 3 input items | 3 requests, each with its own variables |
| Server down | The service refused the connection - perhaps it is offline |
| Endpoint empty | Workflow will not start: Parameter "Endpoint" is required. |
| Query empty | Workflow will not start: Parameter "Query" is required. |
Checklist
- POST and Request Format JSON, not GET or Raw.
- Variables built with JSON.stringify or an object expression.
Bearerin front of the token.- An IF or Filter on
$json.dataafter the node. - Response Format String when the error says the body is not valid JSON.
- Split Out on the list inside
data.
What we did not test
Real public GraphQL APIs, Header Auth and OAuth2 credential types, introspection, cursor pagination, file uploads, subscriptions, self-signed certificates, n8n Cloud and the editor UI.
Start from a working agent
FAQ
Why does the n8n GraphQL node say "Using variables failed"?
The Variables field is not valid JSON, usually single quotes or an expression value without quotes. Use {{ JSON.stringify({ ... }) }} or an object expression instead of building JSON by hand.
Why are my GraphQL variables not sent from n8n?
GET and the GraphQL (Raw) request format do not send variables, and node version 1 defaults to Raw. Use POST with Request Format JSON.
Why does the GraphQL node fail when the API returned data?
If the reply has an errors array, n8n fails the node with the first message and drops any partial data. On Error Continue keeps the response but adds an extra error item.
Why is a 401 from my GraphQL API green in n8n?
The node does not fail on HTTP status when the reply is JSON. Check that $json.data exists after the node, and add the Bearer prefix to the token.
How do I fix "Response body is not valid JSON" in the GraphQL node?
The server sent HTML or text, often an error page. Set Response Format to String to see the body and the real error.
How do I get one item per result from the GraphQL node?
The node returns one item with the list inside data. Add a Split Out node on the list field, for example data.users.
Related guides
- n8n XML node not working: parse errors, one item vs array, attributes and Split Out, 39 runs
- n8n Crypto node not working: HMAC webhook signatures that never match, missing secret and errors, 57 runs
- n8n HTTP Request pagination not working: endless loops, duplicates and fixes, 27 runs
- n8n API 401 Unauthorized or 403 Forbidden: API key fixes, tested
- n8n 429 Too Many Requests: fix rate limits with Retry On Fail, batching or Retry-After
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes