{"record":{"id":"187da87ac1386696","repo":"toeverything/AFFiNE","slug":"graphql-query-responds-unexpected-result-query","errorCode":null,"errorMessage":"GraphQL query responds unexpected result, query ${options.query.op}","messagePattern":"GraphQL query responds unexpected result, query (.+?)","errorType":"exception","errorClass":"GraphQLError","httpStatus":null,"severity":"error","filePath":"packages/common/graphql/src/fetcher.ts","lineNumber":233,"sourceCode":"      })\n    ).then(async res => {\n      if (res.headers.get('content-type')?.startsWith('application/json')) {\n        const result = (await res.json()) as ExecutionResult;\n        if (res.status >= 400 || result.errors) {\n          if (result.errors && result.errors.length > 0) {\n            // throw the first error is enough\n            const firstError = result.errors[0];\n            throw new GraphQLError(firstError.message, firstError);\n          } else {\n            throw new GraphQLError('Empty GraphQL error body');\n          }\n        } else if (result.data) {\n          // we have to cast here because the type of result.data is a union type\n          return result.data as any;\n        }\n      }\n\n      throw new GraphQLError(\n        'GraphQL query responds unexpected result, query ' + options.query.op\n      );\n    });\n\n    return ret;\n  };\n\n  return gqlFetch;\n};\n","sourceCodeStart":215,"sourceCodeEnd":243,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/common/graphql/src/fetcher.ts#L215-L243","documentation":"gqlFetch throws when a query without errors returns no data field, meaning the GraphQL endpoint responded 2xx with neither errors nor data — an unexpected result shape for the operation ${options.query.op}.","triggerScenarios":"Thrown at packages/common/graphql/src/fetcher.ts:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the query operation name matches a resolver implemented on the server.","Check that the server and client GraphQL schemas are in sync; regenerate types if needed.","Inspect the raw response to see whether the server returned data in an unexpected shape."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}