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.prismaDeclare 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.schemawhen the schema is not in the default path. - Pass
--schemaconsistently in every workflow step. - Keep the schema location the same locally and in CI.
Related guides
Prisma "Error validating" in schema.prisma in CIFix "Error validating" in schema.prisma in CI - Prisma parses and validates the schema before any command run…
Prisma "prisma: command not found" (use npx prisma) in CIFix "prisma: command not found" in CI - the Prisma CLI is a local dev dependency and is not on PATH, so a bar…
Prisma "Cannot find module '.prisma/client'" in CIFix "Error: Cannot find module '.prisma/client'" in CI - the generated client output directory does not exist…