db error
im getting this error when running wasp db migrate-dev.
Error: P3014
Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow
Original error:
ERROR: template database "template1" has a collation version mismatch
DETAIL: The template database was created using collation version 2.36, but the operating system provides version 2.41.
HINT: Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
0: schema_core::state::DevDiagnostic
at schema-engine/core/src/state.rs:276
❌ --- [Error] Migrate dev failed: ------------------------------------------------
Migrate (dev) failed with exit code: 1 whats the issue here
About the shadow database | Prisma Documentation
About the shadow database
4 Replies
Hi @Bruno Njeru. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
It’s a Prisma Migrate error while creating the shadow database. Prisma needs to create a temporary (shadow) DB to compare schemas; your Postgres instance is failing due to a collation version mismatch in template1, which Prisma uses to create that shadow DB. The error is coming from Postgres itself, not Wasp.
What you can do (based on our sources, we don’t have a Wasp-specific fix documented for this case):
- Ensure you can run wasp db migrate-dev in an environment where Prisma can create databases (user has createdb permission). [DB commands]
- If Prisma can’t operate interactively or hits environment issues, it will fail migrate-dev; running migrate-dev requires a healthy DB setup. [Non-interactive migrate]
- The error about “database does not exist” during setup is often a red herring; the real blocker is the DB-level error you posted. [DB error thread]
Given the specific Postgres collation mismatch, the fix is on the database side (adjust template1 collation version or recreate/refresh the template DB as the error suggests). Our knowledge sources don’t include Wasp-specific steps for repairing template1 or bypassing Prisma’s shadow DB creation. I’m sorry, but the knowledge sources do not explicitly mention a Wasp-side workaround for this Postgres collation version issue.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Bruno Njeru, 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?
@Bruno Njeru how did this go? Did resetting dev postgres db help maybe? Sounds like something got messed up with the state on your disk, be it a change in postgres db version or something.
I don't know I just decided to remove the changes in my schema since they were not necessary so no need to migrate @martinsos but I tried resetting the db and wasp db migrate-dev but the error was still there
@martinsos here is the logs from docker/the terminal running wasp start db. the error is still there so it means i cant run wasp db migrate-dev 166] WARNING: database "PetAll-b82270bd4f" has a collation version mismatch
2025-09-20 14:04:27.037 UTC [166] DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41.
2025-09-20 14:04:27.037 UTC [166] HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE "PetAll-b82270bd4f" REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
2025-09-20 14:04:48.863 UTC [27] LOG: checkpoint starting: time
2025-09-20 14:04:50.816 UTC [167] WARNING: database "PetAll-b82270bd4f" has a collation version mismatch
2025-09-20 14:04:50.816 UTC [167] DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41.
2025-09-20 14:04:50.816 UTC [167] HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE "PetAll-b82270bd4f" REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
2025-09-20 14:04:52.671 UTC [27] LOG: checkpoint complete: wrote 38 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=3.739 s, sync=0.034 s, total=3.809 s; sync files=20, longest=0.010 s, average=0.002 s; distance=164 kB, estimate=164 kB; lsn=0/17BA12D8, redo lsn=0/17BA1280
2025-09-20 14:04:53.036 UTC [168] WARNING: database "PetAll-b82270bd4f" has a collation version mismatch
2025-09-20 14:04:53.036 UTC [168] DETAIL: The database was created using collation version 2.36, but the operating system provides version 2.41.
it was working fine before
@Bruno Njeru it might be this, check it out https://github.com/wasp-lang/wasp/issues/1606
GitHub
Pin down postgres version in managed dev db · Issue #1606 · wasp-...
Right now in our managed dev db we use docker image postgres:latest, which means at some point, version of postgres changes, and your local dev database might now work with it. At that moment you h...