toeverything/AFFiNE · error · GraphQLError
GraphQL query responds unexpected result, query ${options.qu
Error message
GraphQL query responds unexpected result, query ${options.query.op} What it means
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}.
Source
Thrown at packages/common/graphql/src/fetcher.ts:233
})
).then(async res => {
if (res.headers.get('content-type')?.startsWith('application/json')) {
const result = (await res.json()) as ExecutionResult;
if (res.status >= 400 || result.errors) {
if (result.errors && result.errors.length > 0) {
// throw the first error is enough
const firstError = result.errors[0];
throw new GraphQLError(firstError.message, firstError);
} else {
throw new GraphQLError('Empty GraphQL error body');
}
} else if (result.data) {
// we have to cast here because the type of result.data is a union type
return result.data as any;
}
}
throw new GraphQLError(
'GraphQL query responds unexpected result, query ' + options.query.op
);
});
return ret;
};
return gqlFetch;
};
View on GitHub (pinned to b4c8548c09)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/common/graphql/src/fetcher.ts:233 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/187da87ac1386696.
Report an issue: GitHub.