# Prisma Client could not locate the Query Engine for runtime: how to fix it

> Prisma Client could not locate the Query Engine for runtime debian-openssl-3.0.x, or the older Query engine library for current platform could not be found, means the client was generated for another platform, usually your laptop, or its engine file was not copied. Run prisma generate where the app is built, add the runtime to binaryTargets, and do not ship node_modules. Prisma 7 has no Rust engine, so the error ends there.

Source: https://livops.dev/en/guides/error-prisma-query-engine-not-found

By Livops team, the people who build and run Livops. Updated 1 December 2026.

What Prisma Client prints when it cannot find its engine, here for an app generated on an Apple Silicon Mac and started on Debian or Ubuntu with OpenSSL 3[1][3][4]:

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

This happened because Prisma Client was generated for "darwin-arm64", but the actual deployment required "debian-openssl-3.0.x".
Add "debian-openssl-3.0.x" to `binaryTargets` in the "schema.prisma" file and run `prisma generate` after saving it:
...
The following locations have been searched:
  ...
```

Older releases, such as Prisma 4.7, said the same thing in other words[10]:

```text
Query engine library for current platform "debian-openssl-3.0.x" could not be found.
This probably happens, because you built Prisma Client on a different platform.
```

This page explains what the query engine is and why it goes missing, gives the fix for each cause the message names, covers the OpenSSL variant, and says which of it still applies on Prisma 6.16 and later and on Prisma 7.

## What does the error mean?

Up to Prisma 6, Prisma Client talks to the database through a query engine written in Rust[13]. By default the client loads it as a Node-API library[13]: one native file per platform, named after the platform, such as `libquery_engine-debian-openssl-3.0.x.so.node` on Linux or `libquery_engine-darwin-arm64.dylib.node` on an Apple Silicon Mac[8]. `prisma generate` downloads that file into the generated client[13].

Which files it downloads is set by `binaryTargets` in the `generator` block, and the default is `native`[11]: the platform of the machine that runs `prisma generate`, as the error's own wording shows (`Prisma Client was generated for "darwin-arm64"`)[3]. At startup the client works out the platform it is running on, looks for that platform's file in the generated client folder and a few other places, and throws `PrismaClientInitializationError` if none has it[2].

The text after the first line tells you which case you are in[2]:

| The message continues with | What happened |
| --- | --- |
| `Prisma Client was generated for "…", but the actual deployment required "…"` | The client was generated on another platform, with `native` only[3] |
| `` `binaryTargets` have been pinned, but the actual deployment also required "…" `` | `binaryTargets` lists platforms, but not this one[5] |
| `tooling that has not copied "…" to the deployment folder` | The right file was generated, then lost on the way[6] |
| `a bundler that has not copied "…" next to the resulting bundle` | The client was bundled without its engine file[7] |

The platform names you will meet most[11]:

| Where the app runs | `binaryTargets` value |
| --- | --- |
| Debian or Ubuntu, x86_64 | `debian-openssl-3.0.x` (or `-1.1.x`, `-1.0.x` for older OpenSSL) |
| Alpine 3.17 and newer, x86_64 | `linux-musl-openssl-3.0.x` |
| Alpine 3.16 and older, x86_64 | `linux-musl` |
| Linux on ARM64, except Alpine | `linux-arm64-openssl-3.0.x` (or `-1.1.x`, `-1.0.x`) |
| macOS | `darwin`, `darwin-arm64` |
| Windows | `windows` |

## Causes, most common first

### 1. The client was generated on your laptop

You ran `prisma generate` on macOS or Windows and the result travelled to the server: `node_modules` in the upload or the image, the generated client committed to Git, or a `COPY . .` in a Dockerfile that brought your local `node_modules` along. With `native` only, that client holds the engine for your laptop and nothing else[3].

**Fix: generate where the app is built, and ship no generated code.** Keep `node_modules` and the generated client out of Git, the upload and the Docker build context, and run `prisma generate` after the dependencies are installed on the build machine. Prisma's reference recommends adding the client's output path to `.gitignore` and running `prisma generate` from a build script or a `postinstall` hook[11]:

```json
{
  "scripts": {
    "postinstall": "prisma generate"
  }
}
```

In a Dockerfile, a `.dockerignore` keeps the local folder out of the image; Prisma's current Docker guide lists `node_modules`, `.env` and `.env.prod` in it[19]:

```text
node_modules
.env
.env.prod
```

### 2. binaryTargets does not include the platform you deploy to

Generating on one machine and running on another is fine if the client carries both engines. Add the value the error names, next to `native` so your laptop keeps working, and generate again; it is the fix the message itself suggests[4]:

```prisma
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "debian-openssl-3.0.x"]
}
```

If you already list targets and the message says they `have been pinned`, the list just lacks this platform[5]: add it the same way. Copy the string from the error rather than guessing it: the client prints exactly the platform it was looking for[1].

### 3. prisma generate never ran, or its output was lost

```text
This is likely caused by tooling that has not copied "libquery_engine-debian-openssl-3.0.x.so.node" to the deployment folder.
Ensure that you ran `prisma generate` and that "libquery_engine-debian-openssl-3.0.x.so.node" has been copied to "…".
```

The client found the right platform in `binaryTargets` but not the file[6]. Either `prisma generate` did not run in the build, so an old or foreign client is in use, or a step after it, such as a multi-stage Dockerfile that copies only some folders, left the engine behind. Run `prisma generate` in the same stage that installs dependencies, and copy the generated client folder, the default one being `node_modules/.prisma/client`[11], into the final stage whole.

If the message says **a bundler** has not copied the file next to the bundle, the client was bundled (by webpack or another bundler) and the `.node` file stayed behind[7]. Copy it next to the bundle, or into the folder the message names[7].

### 4. OpenSSL: the library the engine needs is missing

When the file is found but cannot be loaded, the message is different[9]:

```text
Unable to require(`/app/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node`).
Prisma cannot find the required `libssl` system library in your system. Please install openssl-1.1.x and try again.

Details: libssl.so.1.1: cannot open shared object file: No such file or directory
```

The engine links to the system's OpenSSL, and Prisma needs OpenSSL 1.0.x, 1.1.x or 3.x on Linux[14]. When it cannot tell which version is installed, for example because none is, it assumes 1.1.x[14], so a slim image without OpenSSL gets the 1.1.x engine and then fails to load it. Prisma's Docker guide notes that some older `node:slim` images come without `libssl`, and installs it[18]:

```dockerfile
FROM node:slim
RUN apt-get update -y && apt-get install -y openssl
```

Then generate again, so the engine matches the OpenSSL that is now there. On Alpine, do not add `libc6-compat` or another glibc: Prisma's guide says that would prevent Prisma from running[18]. A message that mentions `GLIBC` instead means the system's C library is too old for the engine[9].

## Prisma 6.16 and Prisma 7: the engine is gone

The fixes above are for the Rust engine. Prisma has been removing it:

- **Prisma 6.16 and later** can run without it. Using Prisma without Rust became generally available in 6.16.0 for PostgreSQL, CockroachDB, MySQL, SQLite, SQL Server and others[15]. You set `engineType = "client"` in the generator and pass a driver adapter to `PrismaClient`; no engine is downloaded into the generated client and there is no `binaryTargets` field[15]. Prisma says it was tested with the `prisma-client` generator rather than `prisma-client-js`[15].
- **Prisma 7** makes that the default[13]: the library engine (`engineType = "library"`) and the binary engine (`engineType = "binary"`) were removed[17], and `PRISMA_QUERY_ENGINE_LIBRARY` and `PRISMA_QUERY_ENGINE_BINARY` no longer exist[17]. With no engine file there is nothing for this error to miss.

Upgrading is the most lasting fix, but it changes more than the engine[16]:

```prisma
generator client {
  provider = "prisma-client"
  output   = "./generated/prisma"
}
```

- Every database needs a driver adapter, such as `@prisma/adapter-pg` for PostgreSQL[16].
- `output` is required, and the client is no longer generated into `node_modules`[16]. `prisma-client-js` is deprecated as of Prisma 7[12].
- `migrate dev` and `db push` no longer run `prisma generate`; you run it yourself[16]. Keep it in the build or in `postinstall`.
- Node.js 20.19.0 is the minimum[16].

Prisma's docs now also cover Prisma ORM 8, still a release candidate, which ships no native query engine and has no `prisma generate` step at all[19]. What is above applies to Prisma 4 to 7.

## How to confirm the fix locally

Generate, then look at which engines the client carries. On Prisma 5 or 6 with the default output:

```sh
npx prisma generate
ls node_modules/.prisma/client | grep query_engine
```

You should see one `libquery_engine-…` file for every value in `binaryTargets`, `native` included[8][13], for example `libquery_engine-darwin-arm64.dylib.node` and `libquery_engine-debian-openssl-3.0.x.so.node`. If the platform from the error is not in the list, the deploy cannot find it either. Then check that what you ship does not bring its own copy: `git ls-files node_modules | head` should print nothing.

## On Livops

- **`prisma generate` runs before the build.** When the project has `prisma` and `prisma/schema.prisma`, Livops runs `prisma generate` before the build itself, so the client is generated during the deploy, not on your laptop. If your schema lives elsewhere, add `"postinstall": "prisma generate"` to `package.json`; see [The Prisma client was not generated](https://livops.dev/en/docs/error-build#prisma).
- **`node_modules` never arrives from your machine in an upload.** An uploaded folder has `node_modules`, `.git`, `.next` and similar folders dropped, and Livops installs the dependencies itself. From GitHub, keep `node_modules` and the generated client in `.gitignore`.
- **Node 22 or 24.** Those are the versions Livops has, both above Prisma 7's minimum. If `devEngines` in `package.json` asks for another, set it to 22 or 24.
- **Your own Dockerfile.** A Dockerfile in the repository is used when no framework is recognised; for a recognised project, `"builder": "dockerfile"` in `livops.json` before the project is created. The image is then yours, OpenSSL and `binaryTargets` included.
- **A failed start keeps the old version.** If the client throws at start-up, the deploy fails as `start_failed`, the message is on the **Logs** page, and a web app's previous version keeps serving.

A web app costs **39 credits a month**. Once the client starts, the next error on the way is usually the connection: [Prisma P1001: Can't reach database server](https://livops.dev/en/guides/error-prisma-p1001-cant-reach-database).

## Questions

**Why does Prisma work on my Mac and fail on the server?**

Because the client was generated on the Mac. With the default binaryTargets, native, prisma generate downloads only the engine for the machine it runs on, a darwin or darwin-arm64 file. The Linux server needs another file, such as the one for debian-openssl-3.0.x, and it is not there.

**Which binaryTargets value do I need?**

The one the error names after for runtime. Prisma prints the platform it was looking for, so add exactly that string next to native, for example debian-openssl-3.0.x on Debian or Ubuntu with OpenSSL 3, or linux-musl-openssl-3.0.x on Alpine 3.17 and newer, and run prisma generate again.

**Should I add prisma generate to postinstall?**

It is the simplest way to make sure the client is generated wherever dependencies are installed, and Prisma's own reference recommends a build script or a postinstall hook. Prisma 7 no longer generates the client for you after migrate dev or db push, so the explicit step matters more there.

**Is it safe to commit node_modules or the generated client?**

Not across platforms. Whatever you commit carries the engine for the machine that generated it. Keep both out of the repository and the upload, and let the build install dependencies and run prisma generate on the platform the app runs on.

**What does libssl.so cannot open shared object file mean with Prisma?**

The engine file was found but needs an OpenSSL library the system does not have. Prisma says it cannot find the required libssl system library and names the OpenSSL version to install. Install openssl in the image, or make the engine match the OpenSSL that is there.

**Does Prisma 7 still have this error?**

Not from Prisma Client. Prisma 7 removed the library and binary query engines, so there is no engine file to look for. It needs a driver adapter for every database and an output path for the generated client, and you still run prisma generate yourself.

## Sources

1. [Prisma source — queryEngineCannotBeFound.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/queryEngineCannotBeFound.ts). Checked 1 December 2026.
2. [Prisma source — resolveEnginePath.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/resolveEnginePath.ts). Checked 1 December 2026.
3. [Prisma source — nativeGeneratedOnDifferentPlatform.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/nativeGeneratedOnDifferentPlatform.ts). Checked 1 December 2026.
4. [Prisma source — addRuntimeToYourBinaryTargets.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/addRuntimeToYourBinaryTargets.ts). Checked 1 December 2026.
5. [Prisma source — binaryTargetsWasIncorrectlyPinned.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/binaryTargetsWasIncorrectlyPinned.ts). Checked 1 December 2026.
6. [Prisma source — toolingHasTamperedWithEngineCopy.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/toolingHasTamperedWithEngineCopy.ts). Checked 1 December 2026.
7. [Prisma source — bundlerHasTamperedWithEngineCopy.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/client/src/runtime/core/engines/common/errors/engine-not-found/bundlerHasTamperedWithEngineCopy.ts). Checked 1 December 2026.
8. [Prisma source — getNodeAPIName.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/get-platform/src/getNodeAPIName.ts). Checked 1 December 2026.
9. [Prisma source — handleEngineLoadingErrors.ts (6.19.3)](https://raw.githubusercontent.com/prisma/prisma/6.19.3/packages/internals/src/utils/handleEngineLoadingErrors.ts). Checked 1 December 2026.
10. [Prisma source — DefaultLibraryLoader.ts (4.7.0)](https://raw.githubusercontent.com/prisma/prisma/4.7.0/packages/engine-core/src/library/DefaultLibraryLoader.ts). Checked 1 December 2026.
11. [Prisma ORM v6 — Prisma Schema API](https://www.prisma.io/docs/orm/v6/reference/prisma-schema-reference). Checked 1 December 2026.
12. [Prisma ORM v6 — Generators](https://www.prisma.io/docs/orm/v6/prisma-schema/overview/generators). Checked 1 December 2026.
13. [Prisma ORM v6 — Engines](https://www.prisma.io/docs/orm/v6/more/internals/engines). Checked 1 December 2026.
14. [Prisma ORM v6 — System requirements](https://www.prisma.io/docs/orm/v6/reference/system-requirements). Checked 1 December 2026.
15. [Prisma ORM v6 — No Rust engine](https://www.prisma.io/docs/orm/v6/prisma-client/setup-and-configuration/no-rust-engine). Checked 1 December 2026.
16. [Prisma — Upgrade to Prisma ORM 7](https://www.prisma.io/docs/guides/upgrade-prisma-orm/v7). Checked 1 December 2026.
17. [Prisma changelog — Prisma ORM v7.0.0](https://www.prisma.io/changelog/2025-11-19). Checked 1 December 2026.
18. [Prisma ORM v7 — How to use Prisma in Docker](https://www.prisma.io/docs/guides/v7/deployment/docker). Checked 1 December 2026.
19. [Prisma — How to use Prisma ORM in Docker (Prisma ORM 8)](https://www.prisma.io/docs/guides/deployment/docker). Checked 1 December 2026.
