question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLI crash when run on empty `schema.prisma`

See original GitHub issue
  • npm init -y
  • npm install prisma@dev
  • Then:
C:\Users\Jan\Documents\throwaway\envRepro  (envRepro@1.0.0)
λ npx prisma db push
Prisma schema loaded from schema.prisma
Error: Get config thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', query-engine\query-engine\src\opt.rs:148:21
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

C:\Users\Jan\Documents\throwaway\envRepro  (envRepro@1.0.0)
λ npx prisma migrate dev
Prisma schema loaded from schema.prisma
Error: Get config thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', query-engine\query-engine\src\opt.rs:148:21
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

vs. handled error in Introspection:

C:\Users\Jan\Documents\throwaway\envRepro  (envRepro@1.0.0)
λ npx prisma introspect
Prisma schema loaded from schema.prisma

Introspecting based on datasource defined in schema.prisma …
Error: There is no datasource in the schema.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
jkomynocommented, Jun 27, 2022
1reaction
janpiocommented, Jun 11, 2022

We should:

  1. change “datamodel path” to “schema path” or something that users could understand,
  2. add a snapshot test for all these commands in its current state,
  3. then decide if there is a better way to handle that (in the CLI for example where we can shot a unified and nicer error message instead of letting getdmmf and others handle this problem.

Side question: Why are db push and db pull different than the others?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Engine panics when schema.prisma is empty, we could make ...
During the rendering of the error (putting the nice underlines and such) this crashes because the original input is less long in this...
Read more >
Error message reference - Prisma
Prisma Client throws a PrismaClientRustPanicError exception if the underlying engine crashes and exits with a non-zero exit code. In this case, the Prisma ......
Read more >
Prisma CLI Command Reference
This page gives an overview of all available Prisma CLI commands, explains their ... Run prisma db pull to turn your database schema...
Read more >
Handling exceptions and errors (Reference) - Prisma
This will throw an error because the email field has the @unique attribute applied to it. schema.prisma.
Read more >
Migration troubleshooting in development - Prisma
If Prisma Migrate detects a migration history conflict when you run prisma migrate dev , the CLI will ask to reset the database...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found