GraphQL Code Generator "Failed to load schema: Unable to find any GraphQL type definitions" in CI
GraphQL Code Generator loads the schema from the schema pointer in codegen.yml. When the glob or path matches no files that contain GraphQL SDL, it reports "Unable to find any GraphQL type definitions for the following pointers" and lists the unmatched pointer.
What this error means
graphql-codegen fails with "Failed to load schema from <pointer>: Unable to find any GraphQL type definitions for the following pointers: <pointer>" and the generated output is never written.
Failed to load schema from ./src/schema/**/*.graphql:
Unable to find any GraphQL type definitions for the following pointers:
- ./src/schema/**/*.graphqlCommon causes
The schema glob matches nothing in CI
A relative path or glob that worked locally resolves to an empty set in CI because the working directory, casing, or checkout layout differs.
The pointer files contain no SDL
The matched files exist but hold no type definitions (for example, only operations), so codegen finds no schema to load.
How to fix it
Point the schema at files that exist in CI
- Run the same glob in CI (
ls src/schema/**/*.graphql) to confirm it matches. - Fix the path or casing so it resolves from the repo root the job runs in.
- Re-run codegen and confirm the schema loads.
# codegen.yml
schema: ./src/schema/**/*.graphql
documents: ./src/**/*.graphql
generates:
./src/generated/graphql.ts:
plugins:
- typescriptLoad the schema from a running endpoint or introspection file
If SDL is not in the repo, point at an introspection JSON or a URL the job can reach.
# codegen.yml
schema: ./schema.introspection.jsonHow to prevent it
- Use repo-root-relative schema pointers that resolve in CI.
- Commit the SDL or introspection file the generator reads.
- Verify the glob matches in the CI checkout, not just locally.