error schema.prisma:63
Hi Guys, i get the following error when creating a new project in wasp it says schema.primsa is already in use but i completely removed the dir where the previous project was and i tried to uninstall wasp / clean wasp nothing yet has worked. What else can i do? Thank you.
error: The model "Session" cannot be defined because a model with that name already exists.
[ Db !] --> schema.prisma:63
15 Replies
Hi @Goldsoull. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The error message you're seeing suggests that there's a duplicate model named "Session" in your
schema.prisma
file. This could happen if you've accidentally defined the same model twice in your Prisma schema.
Here are a few steps you can take to resolve this issue:
1. Open your schema.prisma
file and look for any duplicate definitions of the "Session" model. If you find any, remove the duplicates.
2. After making changes to your Prisma schema, you'll need to run a database migration. You can do this by running the command wasp db migrate-dev
in your terminal. This instructs Prisma to create a new database migration and apply it to the database. source (https://wasp-lang.dev/docs/tutorial/entities)
3. If the error persists, you might want to try running wasp clean
and then wasp start
again. This has helped resolve similar issues in the past. source (https://discord.com/channels/686873244791210014/1204021576979324949)
If none of these steps resolve your issue, it might be helpful to provide more information about your schema.prisma
file and the exact steps you're taking when you encounter this error.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Goldsoull, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Hey @Goldsoull, you've unfortunately ran into Wasp's edge case.
Quick solution: Rename your entity to something other than
Session
.
Explanation: Session
is a reserved name for entities because Wasp already defines the Entity that's called Session
under the hood. When you name one of your entities Session
, it creates a name clash (Prisma doesn't allow two entities with the same name).
@miho I seem to remember we were trakcing this somewhere. Do we have an issue?I don't think we ever created an issue for this particular Prisma issue, we should ideally detect these name clashes between internal models and user models and output a good error message that says what you explained here π
Would you mind creating this issue?
Here it is: https://github.com/wasp-lang/wasp/issues/1981
GitHub
Prevent name clashes between Wasp's and user's Entities Β· Issue #19...
If a user creates and entity and its name matches one of Wasp's internal entities (e.g., Session), they get an error due to a name clash: error: The model "Session" cannot be defined ...
Hi Sodic, thank you for the fast response, but i have to admit i still don't know how to change the "session" name at all. What kind of code do i need to type in to change the name of the session? Yes, i am new to this as you can see : )
Haha @Goldsoull, no problem.
Just rename the entity named
Session
in your main.wasp file something to other tham Session
.
If you're stil confused, send the wasp file and I'll take care of it πI think you mean this one?
That's the one, I'll take a look tomorrow
Here you go π
This Worked, but now...
Wohooo @Goldsoull, you just became a Waspeteer level 1!
Changing the session name has worked, but now SDK build failed - Cannot find module "wasp/ext-src/actions.js"
Hey @Goldsoull, we can't really say much more without seeing your full app.
If you don't mind sharing it, I can maybe help you out.