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.
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
- Add the runner or deploy platform to
binaryTargetsin the generator. - Run
prisma generateon a machine or in CI where the engines are produced. - Deploy or test with the engines for that platform present.
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.
- run: npm ci
- run: npx prisma generate # runs on the same runner OSHow 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.