Skip to content
Latchkey

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.

graphql-codegen
Failed to load schema from ./src/schema/**/*.graphql:
        Unable to find any GraphQL type definitions for the following pointers:
          - ./src/schema/**/*.graphql

Common 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

  1. Run the same glob in CI (ls src/schema/**/*.graphql) to confirm it matches.
  2. Fix the path or casing so it resolves from the repo root the job runs in.
  3. Re-run codegen and confirm the schema loads.
codegen.yml
# codegen.yml
schema: ./src/schema/**/*.graphql
documents: ./src/**/*.graphql
generates:
  ./src/generated/graphql.ts:
    plugins:
      - typescript

Load 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
# codegen.yml
schema: ./schema.introspection.json

How 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →