Skip to content
Latchkey

Prisma "prisma generate" Engine Download Failed in CI

Prisma Client generation downloads a query-engine binary at build time. The download from the Prisma binaries CDN did not complete - a connectivity, proxy, or CDN-slowness problem, not a schema issue.

What this error means

prisma generate (or postinstall) fails while fetching the engine, reporting a download/timeout error against binaries.prisma.sh. It frequently succeeds on retry once the network or CDN recovers.

prisma output
Error: Failed to fetch the engine file at
https://binaries.prisma.sh/.../libquery_engine-debian-openssl-3.0.x.so.node.gz
  request to ... failed, reason: connect ETIMEDOUT

Common causes

Transient network blip to the binaries CDN

A brief connectivity drop or slow CDN response makes the engine download exceed its timeout. Nothing is wrong with your schema - the fetch just did not finish.

Proxy or firewall blocking binaries.prisma.sh

A locked-down runner may not be allowed to reach the Prisma CDN, so every download attempt fails until the host is allow-listed or a mirror is configured.

No engine cache between runs

Without caching, every CI run re-downloads the engine, multiplying the chance of hitting a flaky network.

How to fix it

Retry generation for a transient failure

Because the download is usually transient, a bounded retry clears it with no change.

Terminal
for i in 1 2 3; do
  npx prisma generate && break
  echo "engine download retry $i"; sleep 5
done

Cache the Prisma engines and node_modules

Caching avoids re-downloading the engine each run, so a flaky CDN matters far less.

.github/workflows/ci.yml
- uses: actions/cache@v4
  with:
    path: |
      node_modules/.prisma
      ~/.cache/prisma
    key: prisma-${{ hashFiles('prisma/schema.prisma') }}

Allow the CDN or use a mirror

  1. Allow-list binaries.prisma.sh through the proxy/firewall on the runner.
  2. For locked-down networks, set PRISMA_ENGINES_MIRROR to an internal mirror of the binaries.
  3. Confirm the generated binaryTargets match the runtime so only needed engines download.

How to prevent it

  • Cache the Prisma engine directory keyed on the schema.
  • Allow binaries.prisma.sh (or set PRISMA_ENGINES_MIRROR) on restricted runners.
  • Pin the Prisma version so the engine set is stable and cacheable.

Frequently asked questions

What causes ""failed to fetch the engine""?
A brief connectivity drop or slow CDN response makes the engine download exceed its timeout. Nothing is wrong with your schema - the fetch just did not finish.
How do I fix "failed to fetch the engine"?
Because the download is usually transient, a bounded retry clears it with no change.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card