Schema could not be found after Prisma 6.6.0 update
Before 6.6.0, prisma generate was working completely fine. Now, it isn't able to find the schema file located in ./prisma/schema/schema.prisma
I tried running the command with --schema to specify the location, and then the following is the result of that:
The following is my schema.prisma:
This completely broke Prisma for me and it was working completely fine before this. @prisma/client and prisma are both at version 6.6.0.
Any help would be much appreciated.
3 Replies
You opted for speed from this bot. Let's conjure up an answer right now!
Based on the information in the knowledge sources, I can help explain what's happening with your Prisma schema after updating to version 6.6.0.
In Prisma 6.6.0, there was a significant change to how Prisma locates schema files and migrations folders. According to the documentation, when using the
prismaSchemaFolder
preview feature, Prisma expects your models to be defined in separate .prisma
files within the schema folder, not in the main schema.prisma
file.
The issue you're experiencing is that your main schema.prisma
file only contains the generator and datasource configurations, but no models. With the 6.6.0 update, Prisma is correctly loading your schema file but then reporting that it doesn't contain any models.
According to a contributor comment in a GitHub issue:
With Prisma 6.6.0 we are updating the logic of how the migrations folder is searched for in relation to your schema files and the specified schema folder: a) If you want to read schema files from a folder you always have to explicitly pass the path to it via either: - theGitHub Issue #24491 To fix this issue, you need to: 1. Make sure you have separate--schema
cli arg, - the package.jsonprisma.schema
field, - or theschema
property inprisma.config.ts
. b) Prisma will search for the migrations folder next to the schema files that contains thedatasource
block. This would usually be your main schema file directly in the specified schema folder.
.prisma
files in your prisma/schema
directory that contain your model definitions
2. Ensure your main schema.prisma
file is correctly configured with the prismaSchemaFolder
preview feature
This is similar to an issue another user faced, as described in GitHub Issue #25607, where they had a similar folder structure but were missing model definitions in their schema files.
If you already have model def
initions in separate .prisma
files within your schema folder, make sure they're properly formatted and that Prisma can access them. The error message suggests that Prisma isn't finding any models in your schema setup.
I recommend checking that:
1. Your model files have the .prisma
extension
2. They're located in the correct directory (prisma/schema/
)
3. They contain valid model definitions
4. You're using the correct command to generate the client with the schema path specified
If the issue persists, you might need to adjust your folder structure to match the new expectations in Prisma 6.6.0.
š¤ Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Hey š
Does the error go away if you downgrade to prisma version 6.5.0?
Is your repository open source? I would like to reproduce this and check
Hi, thanks for your response. I was just able to fix it now by explicitly adding the schema folder into my config.