prisma: CLI crash when run on empty `schema.prisma`
npm init -ynpm 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.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- cli: added snapshots for commands referencing empty schemas for issue #7186 — committed to prisma/prisma by jkomyno 2 years ago
- chore: add snapshots for commands referencing empty schemas (#14852) * cli: added snapshots for commands referencing empty schemas for issue #7186 * chore: added conditional empty-schema tests for... — committed to prisma/prisma by jkomyno 2 years ago
Couldn't find a datasource in the prisma.schema filemessage appearing inprisma db pushcomes from theensureDatabaseExistsfunction ofensureDatabaseExists.tsThere is no datasource in the schema.message appearing inprisma db pullcomes from the query engines, e.g., from here.We should:
getdmmfand others handle this problem.Side question: Why are
db pushanddb pulldifferent than the others?Error message is now different in 3.6.0:
This now looks like a TypeScript problem in the Migrate CLI, probably trying to access the
datasource.urlwhich does not exist as the file is empty.Update:
db pullnow also shows the same behavior instead of a good error message before:Pushing this to team/client because the crash is in the query engine (most likely getConfig).