MismatchedTokenException when migrating from neon/docker to prisma postgres
For some reason im getting a schema parsing error when moving from docker (locally) + neon to prisma postgres.
I started with bunx prisma dev to spin up a local dev database.
After running prisma generate + prisma migrate, I'm getting the following error MismatchedTokenException: Expecting --> '{' <-- but found --> 'non-linear' <--
I'm not sure why switching db providers would cause the schema to be invalid
11 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
The error you're seeing,
MismatchedTokenException: Expecting --> '{' <-- but found --> 'non-linear' <--
, typically points to a syntax issue in your Prisma schema file, not a direct problem with switching database providers. However, switching providers (e.g., from Neon/docker to a local Postgres instance) can surface schema or migration issues that were previously hidden or ignored.
A few key points from the knowledge sources:
- When switching database providers, you cannot reuse migration files generated for a different provider (e.g., SQLite or Neon) because they may contain provider-specific SQL. This can cause migration or schema parsing errors. The recommended approach is to delete old migration files and generate new ones for the new provider. This is confirmed in several issues, where users resolved similar errors by deleting prior migrations and starting fresh with the new provider's migrations Syntax error when migrating to postgres via a docker-compose container db push error after migrating from Planetscale to Neon.
- Prisma's migration engine expects the schema and migration files to match the current provider. If you have migration files with SQL or schema definitions incompatible with your new provider, parsing errors like the one you see can occur.
- The error message itself suggests a typo or invalid block in your schema.prisma file. Double-check for any misplaced or misspelled keywords, especially around model or enum definitions.
What to do:
1. Delete your existing migration files (especially if they were created for a different provider).
2. Double-check your schema.prisma for syntax errors—look for any unexpected words or misplaced braces.
3. Run prisma migrate dev
again to generate fresh migrations for your current provider.
If you still encounter issues, please share the relevant part of your schema.prisma file where the error
occurs, as the knowledge sources do not provide details on the specific "non-linear" token.
In summary: Switching providers requires fresh migrations and a valid schema. Old migrations or schema typos are the most common cause of this error when changing providers Syntax error when migrating to postgres via a docker-compose container.
🤔 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.I already re-generated my migration files
here it is
Hey!
The error you are facing seems to be related to enums:
I'm getting the following error MismatchedTokenException: Expecting --> '{' <-- but found --> 'non-linear' <--
You have an enum
NONLINEAR
, was it defined as NON-LINEAR
or something else before?
You get this error as soon as you run npx prisma migrate
command?Nope im able to run migrate perfectlly fine, an view the db via other programs like Postico, but using prisma studio and trying to do a db query with prisma client causes this to break
Ah, okay!
Would it be possible for you to provide a minimal reproduction so that I can share it with team internally?
sorry about that. here is the repo https://github.com/ryanyue123/prisma-postgres-error
to reproduce, i created a dev db using bux prisma dev and added that DATABASE_URL to the .env in server/
for example:
then i ran
bun db:studio
and was able to see the errorGitHub
GitHub - ryanyue123/prisma-postgres-error
Contribute to ryanyue123/prisma-postgres-error development by creating an account on GitHub.
hi @Nurul (Prisma) sorry to bother you. any feedback on this?
hey just wanted to bump this here. @Nurul (Prisma) or if anyone else could help!
Hey, thanks!
Sorry for the delay in getting back.
I'll try reproducing this today
I followed the instructions and I got the Studio UI. Were you able to reach this UI or were getting the error even before seeing this UI?

I was not able to reach this UI, i would get the error.
im using bun - maybe it's something wrong with my local machine?
Would be interesting to see if you run into the same issue on other device