no datasource in schema and schema.prisma empty in .wasp
hi, I've been trying to get wasp to compile with just fresh starter projects or the saas template. However, for the last three days I have been running into the same error and it's driving me insane! I have tried: different version of wasp, of node; fresh installs of wasp and running wasp new; sqlite and postgresql. I have used wasp before and deployed using fly.io especially using version 0.16.0 and wanted to check out 0.18.0 before doing a migration.
once again after starting the db by running "wasp start db" it runs using postgresql
next when I run "wasp db migrate-dev" or "wasp compile" I get the following output:
any help is appreciated!
"""
π --- Compiling wasp project... --------------------------------------------------
β
--- Successfully completed npm install. ----------------------------------------
π --- Setting up database... -----------------------------------------------------
[ Db !] Error: There is no datasource in the schema.
[ Db !]
[ Db !]
[ Db ] Environment variables loaded from .env
[ Db ] Prisma schema loaded from ../db/schema.prisma
[ Db !] Error:
[ Db !] You don't have any datasource defined in your schema.prisma.
[ Db !] You can define a datasource like this:
[ Db !]
[ Db !] datasource db {
[ Db !] provider = "postgresql"
[ Db !] url = env("DB_URL")
[ Db !] }
[ Db !]
[ Db !] More information in our documentation:
[ Db !] https://pris.ly/d/prisma-schema
[ Db !]
β --- [Error] Your wasp project failed to compile: -------------------------------
- Prisma client generation failed with exit code: 1
β --- [Error] Compilation of wasp project failed: --------------------------------
1 errors found
"""
58 Replies
Hi @sib._.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I'm sorry you're running into this frustrating issue! Based on your error message:
This means that the generated
If you don't have any entities defined in your
Sometimes, the build artifacts or generated files can get into a bad state. Try running: This will clean out generated files and force Wasp to regenerate everything from scratch. This has resolved similar issues for other users Discord thread. 3. Check main.wasp for db Provider:
Ensure your
You should not manually edit the generated
- Add at least one entity to your
schema.prisma file in your Wasp project's .wasp/out/db/ directory is empty or missing the datasource block. Normally, Wasp generates this file for you based on your main.wasp configuration and any defined entities.
Possible causes and troubleshooting steps:
1. No Entities Defined in main.wasp:If you don't have any entities defined in your
main.wasp, Wasp may generate an empty or incomplete Prisma schema, leading to this error. Try adding at least one dummy entity to your main.wasp file, for example:
Then run wasp db migrate-dev again. This workaround has been suggested for similar issues in the past and can help the Prisma schema generation process proceed correctly Github Issue #398.
2. Corrupted or Incomplete Project State:Sometimes, the build artifacts or generated files can get into a bad state. Try running: This will clean out generated files and force Wasp to regenerate everything from scratch. This has resolved similar issues for other users Discord thread. 3. Check main.wasp for db Provider:
Ensure your
main.wasp file includes a db block specifying the provider, e.g.:
If this is missing, Wasp may not generate the correct datasource in schema.prisma Github Issue #173.
4. Do Not Manually Edit schema.prisma:You should not manually edit the generated
schema.prisma file. Wasp manages this file based on your main.wasp configuration Discord thread.
Summary:- Add at least one entity to your
main.wasp.
- Make sure the db provider is set.
- Run wasp clean and try again.
If after these steps the problem persists, please share your main.wasp file (with sensitive info removed) and any additional error output. There may be a deeper issue, but these steps resolve the most common causes based on the knowledge sources.
Let me know how it goes!
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speechballoon:
----------------------
Sorry @sib.., 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?@kapa.ai still not working can you investigate '- Prisma client generation failed with exit code: 1'
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the knowledge sources, the error message:
is typically caused by issues with the generated
schema.prisma file, most often when it is missing a datasource block or is empty. This can happen if:
- No entities are defined in your main.wasp file, which leads to Wasp generating an empty or incomplete Prisma schema. The workaround is to define at least one dummy entity in your main.wasp file and then run wasp db migrate-dev again. This has been confirmed as a fix in previous issues Github Issue #398.
- The db block specifying the provider (e.g., postgres or sqlite) is missing from your main.wasp file, which prevents Wasp from generating the correct datasource in schema.prisma Github Issue #248.
If you have already tried adding a dummy entity and ensured the db block is present, but the error persists, there may be a deeper issue with how Wasp is generating or handling the Prisma schema. The knowledge sources do not provide a definitive solution beyond these steps.
Additionally, running wasp clean before trying again has resolved similar issues for other users, as it forces regeneration of all build artifacts and dependencies Discord support thread.
If none of these steps resolve the issue, the knowledge sources do not contain enough information to provide a more specific solution. In that case, sharing your main.wasp file and the full error output with the Wasp community or opening a GitHub issue may help identify the root cause.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speechballoon:
----------------------
Sorry @sib.., 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?@sib._. Can you share your prisma.schema file?
here @genyus generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
tasks Task[]
}
model Task {
id Int @id @default(autoincrement())
description String
isDone Boolean @default(false)
user User @relation(fields: [userId], references: [id])
userId Int
}
sorry for the late reply was cooking
@kapa.ai I've tried this and it does not work at all still
Let me check the knowledge base for you again. One moment! :books:
----------------------
I'm sorry to hear that the previous steps did not resolve your issue. Based on the knowledge sources, the error:
is most commonly linked to problems with the generated
schema.prisma fileβspecifically, it being empty or missing a datasource block. This typically happens if there are no entities defined in your main.wasp file, or if the db block is missing or misconfigured. Adding a dummy entity and ensuring the db block is present are the main recommended solutions, and running wasp clean has helped some users in similar situations.
However, since you have already tried these steps and the problem persists, I must state that the knowledge sources do not contain enough information to provide a more specific or advanced solution for your case. There is no documented fix beyond what has already been suggested, and no deeper troubleshooting steps are available in the provided sources.
If you are still encountering this error after following all the recommended steps, the best course of action would be to share your main.wasp file and the full error output with the Wasp community or to open a GitHub issue, as your situation may require direct investigation by the maintainers or more context-specific troubleshooting.
I'm sorry I can't provide a more definitive answer based on the current knowledge sources.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speechballoon:
----------------------
Sorry @sib.., 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?The file looks fine. Can you run
wasp clean and then compile again. If you get the same error, please share your .wasp/out/db/schema.prima fileit's there but empty
Wohooo @sib._., you just became a Waspeteer level 1!
the schema.prisma file is present in the folder .wasp/out/db/ however there is nothing inside of it, it is just blank
Well, that explains the error, although the question is why it's not being populated. Could you run
wasp compile > log.txt 2>&1 and then share the log.txt file here, please?
Also, you said you've been trying different Node versions, what is the current?[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m Error: There is no datasource in the schema.
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m [33m
π --- Compiling wasp project... --------------------------------------------------
[0m
[33m
β
--- Successfully completed npm install. ----------------------------------------
[0m
[33m
π --- Setting up database... -----------------------------------------------------
[0m
[34m[[0m [34mDb[0m [34m][0m Environment variables loaded from .env
[34m[[0m [34mDb[0m [34m][0m Prisma schema loaded from ../db/schema.prisma
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m Error:
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m You don't have any datasource defined in your schema.prisma.
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m You can define a datasource like this:
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m datasource db {
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m provider = "postgresql"
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m url = env("DB_URL")
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m }
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m More information in our documentation:
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m https://pris.ly/d/prisma-schema
[34m[[0m [34mDb[0m [1m[31m![0m[34m][0m [31m
β --- [Error] Your wasp project failed to compile: -------------------------------
- Prisma client generation failed with exit code: 1[0m
[35m
π --- [Warning] Your wasp project reported following warnings during compilation: ---
- Wasp was unable to verify your database is up to date. Running
wasp db migrate-dev may fix this and will provide more info.[0m
[31m
β --- [Error] Compilation of wasp project failed: --------------------------------
1 errors found[0m
right now I'm using node 22.20.0Does this error only occur with your 0.18 instance? Or you're having the problem with all your local Wasp projects?
i've tried 0.16.0, 0.17.0, 0.18.0 ....
the problem indeed persists with all local wasp projects
it's always the same error for various projects
@genyus any ideas would be appreciated!
If you can, please share your
schema.prisma file here, I suspect it's something with our Prisma parserhere you go, this is a small one (I made for checking if changing wasp versions would fix the error, it didn't...)
I have also tried the default schema.prisma that is generated when doing wasp new MyApp and I have also tried compiling with the schema.prisma from the saas template, all of which with no success..
Can you try doing this:
Does that work for you?
I have tried this. I stil lget the exact same error "Error: There is no datasource in the schema."
Wohooo @sib._., you just became a Waspeteer level 2!
Please run it again so I can see the full output π
here is the output
Run this - let's see what happens when you do it from scratch
this will auto install wasp 18 right?
Yep
The version doesn't matter that much, but I wanted to see it as from-scratch as possible
literally the same error again.
Please copy the full output, here's mine for example:
Here you go.
That's pretty wild π I've never seen this fail like this. What is your Node.js and npm version?
simon@zen:~/test$ node -v
v22.20.0
simon@zen:~/test$ npm -v
10.9.3
Also pls share from the
test project:
the schema.prisma is there but completely empty. in the wasp out db bin
simon@zen:~/dev/test$ cat .wasp/out/db/schema.prisma
simon@zen:~/dev/test$ cat node_modules/.prisma/client/schema.prisma
cat: node_modules/.prisma/client/schema.prisma: No such file or directory
I guess another question for you, what is your OS? Mac, Linux, WSL2? Is your setup specific for some reason? π
Running Ubuntu 24.04 LTS
It's just the stock OS installed
nvm, node and wasp are all installed using apt-get
wasp 0.16 was working fine on the same OS in February, I will try to run a fresh wasp project using an old laptop probably later today to see if maybe it's an OS dependent issue (long shot but still)
Ok, thank you for trying to figure it out with me!
any idea what is going wrong on my system?
Did you do this:
I will try to run a fresh wasp project using an old laptop probably later today to see if maybe it's an OS dependent issue (long shot but still)I'm not really sure what can go wrong, that's why I keep asking you to run things π for me - it works perfectly on my Mac and on my Ubuntu 22 server
no not yet, i just want it to run on this system, my fast larger lighter laptop..
@sodic do you mind picking this one up? I couldn't figure it out - maybe you'll have some fresh idea how to debug this?
Any help would be appreciated as I am hard stuck on things to try
Sure, I'll try
Hey @sib..
Let me get familiar with the issue
Yes, this is very strange indeed.
Alright@sib.., here's what I'll need,
Can you do the same thing Miho asked you to do again:
After you confirm the error is still there, please zip the entire project directory (including all hidden and ignored folders like
.wasp and node_modules) and send it to me. My theory is that your system is somehow altering the project
I'll inspect the files and see whether I can find something strange compared to a new project on my system. If not, I have some other ideas. But let's start with thisI've dm'ed you a google drive link as the zip is around 150mb
@sodic let me know if you notice anything
Wohooo @sib._., you just became a Waspeteer level 3!
I'll dig into this now, thanks. I replied in your DM
alright, thanks!
update: using wasp 0.14.0 for a fresh project works on my system, there are no schema.prisma errors
Oh man but that's old
Good news, I got your error on my system

I'll compare it with a project of my own and we'll get to the bottom of it
Thanks for the patience! I'll jump back into it tomorrow and tell you what I find
Alright, sounds good!
Hey @sib._. I got sick. You're really out of luck with this one
I'm likely back tomorrow and will dig in
So, when you run
wasp start or wasp db migrate-dev, Wasp copies your prisma.schema into .wasp/out/db.
You and Miho correctly realized that this is where the problem occurs. You have a very short .wasp/out/db (just a single newline) and nothing at all in node_modules/.prisma/client/schema.prisma
What we need to figure out is what happens during the copying
When I do wasp clean on your project, everything works. So it's either something with the installed dependencies or something with your system
Yes, even if I only delete .wasp, the next run works. So it's got to be something on the system
We could jump on a call tomorrow if you're up for it?yes, sure thing! Thanks for all your effort.
When does it work for you? I don't know your timezone, but how about 16:00 CET?
I'm on CET too. I'm not available later today sadly, how about tomorrow morning?
Couldn't do it today morning, how about today?
Or, in the meantime, do you have access to a different machine, or a digital ocean server or something?
Just so you confirm all the same steps work there for you
If not, I can set one up for you
Ok, can't do today anymore. But here's another thing you can try to narrow down the issue:
- Try to run a wasp project as a different user and in a completely new file path (one that doesn't share any folders with the one you're trying) on the same machine
- As a same user, on a different file path (e.g., in
/tmp)I have tried to make a new root user on my system. After installing wasp 0.18.0 and the perquisites I get the exact same error!! The new user folder was created in the same directory as my primary user account. Any suggestions what can still be tried?
What exactly is meant by the different file path? Do you mean creating a fresh project in a different folder then previously attempted? I have already tried to make a new project in various different directories on multiple levels.
Filip is currently on a conference in the USA so he might take some time to respond.
One extra debugging tool I found about from Claude is
strace, maybe you can run it and we see what's going on:
Ok, I'm back
Ok, yes, that's what I meant
Looks like the last thing we can try is a call
Let's schedule one for wednesday
I can do:
- Anytime between 9 AM and 12 PM CET.
- 4 PM - 5 PM CET.
Pick any 45 minute slot in those times and I'll send you an invite, I have your email.