{"record":{"id":"f5c4fbc47b5c3627","repo":"quarkusio/quarkus","slug":"joinedgraphqlerrormessages","errorCode":null,"errorMessage":"${joinedGraphQLErrorMessages}","messagePattern":"\\$\\{joinedGraphQLErrorMessages\\}","errorType":"exception","errorClass":"GraphQLError","httpStatus":null,"severity":"error","filePath":"extensions/smallrye-graphql/deployment/src/main/resources/graphql/graphql-client.js","lineNumber":70,"sourceCode":"        }\n        const headers = {\n            'Content-Type': 'application/json',\n            'Accept': 'application/graphql-response+json, application/json',\n        };\n\n        const token = await this._resolveToken();\n        if (token) {\n            headers['Authorization'] = token;\n        }\n\n        const resp = await fetch(this._endpoint, {\n            method: 'POST',\n            headers,\n            body: JSON.stringify(body),\n        });\n        const json = await resp.json();\n        if (json.errors && json.errors.length > 0) {\n            throw new GraphQLError(json.errors, json.data);\n        }\n        return json.data;\n    }\n\n    _wsUrl() {\n        const loc = typeof location !== 'undefined' ? location : {};\n        const proto = (loc.protocol === 'https:') ? 'wss:' : 'ws:';\n        return `${proto}//${loc.host}${this._endpoint}`;\n    }\n\n    _resolveToken() {\n        const provider = this._tokenProvider || GraphQLClient._config.tokenProvider;\n        if (provider) {\n            return provider();\n        }\n        return this._token || GraphQLClient._config.token || null;\n    }\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/smallrye-graphql/deployment/src/main/resources/graphql/graphql-client.js#L52-L88","documentation":"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().","triggerScenarios":"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()).","commonSituations":"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.","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"],"exampleFix":"// before\nconst data = await client.query(QUERY, vars);\n// after\ntry {\n  const data = await client.query(QUERY, vars);\n} catch (e) {\n  if (e instanceof GraphQLError) {\n    e.errors.forEach(err => console.error(err.message)); // server-reported GraphQL errors\n  }\n}","handlingStrategy":"try-catch","validationCode":"// Preflight the query against the schema before executing\nconst operationName = QUERY.definitions.find(d => d.kind === 'OperationDefinition').name?.value;\nif (!operationName) console.warn('Anonymous operation - server errors harder to trace');","typeGuard":"function isGraphQLError(e) {\n  return e instanceof GraphQLError && Array.isArray(e.errors);\n}","tryCatchPattern":"try {\n  const data = await client.query(QUERY, variables);\n} catch (e) {\n  if (isGraphQLError(e)) {\n    e.errors.forEach(err => console.error('GraphQL error:', err.message, err.path ?? ''));\n  } else {\n    throw e; // network/other failure\n  }\n}","preventionTips":["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"],"tags":["graphql","runtime","javascript","client"],"backgroundTag":"graphql-errors-response","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}