Skip to content
Latchkey

Prisma "Query Engine could not be located for the runtime binary target" in CI

The Prisma Client loads a platform-specific Query Engine binary. When the client was generated for one platform but runs on another (for example generated on macOS, run on Debian), the matching engine is missing and the client refuses to start.

What this error means

The app fails at startup with "Prisma Client could not locate the Query Engine for runtime 'debian-openssl-3.0.x'" and a list of the engines that were actually generated.

Prisma
PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "debian-openssl-3.0.x".

This is likely caused by a bundling step that not included the required files or a runtime that differs from the one the Client was generated for.
The following locations have been searched:
  /app/node_modules/.prisma/client
This engine is generated for "darwin-arm64".

Common causes

Generated for a different OS than the runner

The client was generated on a developer machine or a different image, so only that platform engine exists, not the one the CI runner needs.

binaryTargets does not list the runtime platform

Without an explicit binaryTargets, Prisma generates only for the current platform, which will not match a different deploy or test runner.

How to fix it

Declare the runtime binaryTargets

  1. Add the runner or deploy platform to binaryTargets in the generator.
  2. Run prisma generate on a machine or in CI where the engines are produced.
  3. Deploy or test with the engines for that platform present.
schema.prisma
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}

Generate in the same environment you run in

Running prisma generate inside the same container/OS you deploy guarantees the correct engine is produced.

.github/workflows/ci.yml
- run: npm ci
- run: npx prisma generate   # runs on the same runner OS

How to prevent it

  • List every deploy and CI platform in binaryTargets.
  • Regenerate the client in the target environment, not only locally.
  • Do not ship a client generated for macOS to a Linux runtime.

Related guides

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