quarkusio/quarkus · error · GraphQLError
${joinedGraphQLErrorMessages}
Error message
${joinedGraphQLErrorMessages} What it means
The generated GraphQL UI client's _fetch method posts a query/mutation and, when the GraphQL response contains an errors array, throws a GraphQLError whose message is the joined error messages returned by the server (${joinedGraphQLErrorMessages}). This is an application-level GraphQL error surfaced at runtime to callers of query()/mutate().
Source
Thrown at extensions/smallrye-graphql/deployment/src/main/resources/graphql/graphql-client.js:70
}
const headers = {
'Content-Type': 'application/json',
'Accept': 'application/graphql-response+json, application/json',
};
const token = await this._resolveToken();
if (token) {
headers['Authorization'] = token;
}
const resp = await fetch(this._endpoint, {
method: 'POST',
headers,
body: JSON.stringify(body),
});
const json = await resp.json();
if (json.errors && json.errors.length > 0) {
throw new GraphQLError(json.errors, json.data);
}
return json.data;
}
_wsUrl() {
const loc = typeof location !== 'undefined' ? location : {};
const proto = (loc.protocol === 'https:') ? 'wss:' : 'ws:';
return `${proto}//${loc.host}${this._endpoint}`;
}
_resolveToken() {
const provider = this._tokenProvider || GraphQLClient._config.tokenProvider;
if (provider) {
return provider();
}
return this._token || GraphQLClient._config.token || null;
}
View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the joined messages — they enumerate the exact GraphQL errors returned by the server (field not found, variable mismatch, permission denied, etc.)
- Fix the query/variables to match the current schema, or update the server resolver that throws
- Wrap client.query()/mutate() calls in try/catch handling GraphQLError; the error carries json.errors and json.data (partial results)
- Enable server-side logging to capture resolver stack traces behind generic error messages
Example fix
// before
const data = await client.query(QUERY, vars);
// after
try {
const data = await client.query(QUERY, vars);
} catch (e) {
if (e instanceof GraphQLError) {
e.errors.forEach(err => console.error(err.message)); // server-reported GraphQL errors
}
} Defensive patterns
Strategy: try-catch
Validate before calling
// Preflight the query against the schema before executing
const operationName = QUERY.definitions.find(d => d.kind === 'OperationDefinition').name?.value;
if (!operationName) console.warn('Anonymous operation - server errors harder to trace'); Type guard
function isGraphQLError(e) {
return e instanceof GraphQLError && Array.isArray(e.errors);
} Try / catch
try {
const data = await client.query(QUERY, variables);
} catch (e) {
if (isGraphQLError(e)) {
e.errors.forEach(err => console.error('GraphQL error:', err.message, err.path ?? ''));
} else {
throw e; // network/other failure
}
} Prevention
- Always pass named operations and typed variables matching the current schema
- Regenerate/introspect the client schema after backend changes
- Handle partial results: GraphQLError carries json.data alongside errors
- Log server-side resolver exceptions to explain opaque messages
When it happens
Trigger: Any server-side GraphQL error response: validation errors (unknown fields/variables), resolver exceptions, authorization failures, or malformed queries executed from the GraphQL UI JS client (query() or mutate()).
Common situations: Schema drift after changing the backend schema; missing or wrongly typed variables; unauthenticated requests hitting @RolesAllowed-protected resolvers; server exception messages leaking into the errors array.
Related errors
- Can not load class []
- No datasource named '<dataSourceName>' exists
- quarkus.funqy.export does not match a function: ${export}
- There are no functions to process lambda
- Too many functions. You need to set quarkus.funqy.export
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f5c4fbc47b5c3627.
Report an issue: GitHub.