GraphQL "Cannot query field X on type Y" at runtime in CI
The GraphQL server validated the incoming operation against its schema and the field you selected is not defined on that type. The request is rejected with a 400 and a GRAPHQL_VALIDATION_FAILED error before any resolver runs.
What this error means
An integration test or client call against the running server returns errors with "Cannot query field \"x\" on type \"Y\".", and the HTTP response carries a 400 status with extensions.code GRAPHQL_VALIDATION_FAILED.
{
"errors": [{
"message": "Cannot query field \"fullName\" on type \"User\".",
"locations": [{ "line": 3, "column": 5 }],
"extensions": { "code": "GRAPHQL_VALIDATION_FAILED" }
}]
}Common causes
The query is ahead of the deployed schema
The operation selects a field the running server's schema does not expose, often because the client query was updated but the server build in CI is older.
A typo or wrong type in the selection
The field name is misspelled, or it is selected on the wrong type (for example a field that lives on a nested object, not the parent).
How to fix it
Align the query with the running schema
- Print the schema the server actually serves in CI (SDL or introspection).
- Confirm the field exists on that exact type and fix the selection if not.
- Rebuild the server so its schema matches the operation under test.
# dump the SDL the server serves, then grep for the field
npm run print-schema > schema.graphql
grep -n "fullName" schema.graphqlValidate operations against the schema in CI
Run a static check so an operation that selects a missing field fails early instead of at request time.
npx graphql-validate --schema schema.graphql 'src/**/*.graphql'How to prevent it
- Generate the schema artifact and validate operations against it in CI.
- Deploy schema and client queries from the same commit.
- Treat GRAPHQL_VALIDATION_FAILED in tests as a hard failure, not a warning.