Skip to content
Latchkey

Prisma cannot find schema (custom path / multiple schema files) in CI

By default Prisma looks for prisma/schema.prisma. When the schema is at a custom path, or split into multiple files, a command run without pointing at it cannot find the schema and fails.

What this error means

A Prisma command fails with "Could not find a schema.prisma file that is required for this command." even though a schema exists elsewhere in the repo.

Prisma
Error: Could not find a schema.prisma file that is required for this command.
You can either provide it with `--schema`, set it as `prisma.schema` in your package.json, or put it into the default location.

Common causes

A non-default schema location

The schema is not at prisma/schema.prisma, so a command with no --schema cannot locate it.

A split, multi-file schema not configured

A schema folder split across files needs the schema location declared so Prisma knows where to look.

How to fix it

Point commands at the schema

Pass --schema or declare the location in package.json so every command finds it.

Terminal
npx prisma generate --schema=./db/schema.prisma
npx prisma migrate deploy --schema=./db/schema.prisma

Declare the schema path in package.json

Set prisma.schema once so commands do not need the flag.

package.json
{
  "prisma": {
    "schema": "db/schema.prisma"
  }
}

How to prevent it

  • Declare prisma.schema when the schema is not in the default path.
  • Pass --schema consistently in every workflow step.
  • Keep the schema location the same locally and in CI.

Related guides

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