GraphQL operations match the schema
Why it matters
A GraphQL operation that queries User.emailAddress when the schema defines User.email fails at request time with a schema validation error — the server returns an errors array, the client receives no data, and the page renders whatever skeleton state you wrote for the loading case. Reference integrity between operation and schema is exactly what GraphQL Codegen was built to enforce, and AI tools writing queries without running codegen introduce this drift on nearly every new query.
Severity rationale
Info because GraphQL validation errors surface cleanly in logs and codegen eliminates the class of bug entirely.
Remediation
Wire GraphQL Codegen into install and build so every query is type-checked against the schema. Add the script to package.json:
{
"scripts": {
"codegen": "graphql-codegen --config codegen.yml",
"postinstall": "npm run codegen",
"build": "npm run codegen && next build"
}
}
Import the generated gql tag in src/queries.ts so tsc --noEmit flags every field-name mismatch before deploy.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Hallucinated References Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-slop-hallucinations·automated