Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PANIC: called Option::unwrap() on a None value in query-engine/core/src/query_document/parser.rs:250:87 #11263

Closed
rafagalan opened this issue Jan 19, 2022 · 3 comments
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/bug A reported bug. topic: basic error report
Milestone

Comments

@rafagalan
Copy link

Hi Prisma Team! My Prisma Client just crashed. This is the report:

Versions

Name Version
Node v16.13.0
OS debian-openssl-1.1.x
Prisma Client 3.1.0
Query Engine 0.1.0
Database mysql

Logs

prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:client clientVersion: 3.1.0
prisma:client:libraryEngine internalSetup
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:client clientVersion: 3.1.0
prisma:client:libraryEngine internalSetup
prisma:tryLoadEnv Environment variables not found at null
prisma:tryLoadEnv Environment variables not found at undefined
prisma:tryLoadEnv No Environment variables loaded
prisma:client clientVersion: 3.1.0
prisma:client:libraryEngine internalSetup
prisma:client:libraryEngine Search for Query Engine Library in /usr/local/src/blockchain/node_modules/.prisma/client
prisma:client:libraryEngine loadEngine using /usr/local/src/blockchain/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
prisma:client:libraryEngine Search for Query Engine Library in /usr/local/src/blockchain/node_modules/.prisma/client
prisma:client:libraryEngine loadEngine using /usr/local/src/blockchain/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
prisma:client:libraryEngine Search for Query Engine Library in /usr/local/src/blockchain/node_modules/.prisma/client
prisma:client:libraryEngine loadEngine using /usr/local/src/blockchain/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
prisma:client:libraryEngine library starting
prisma:client:libraryEngine library started
prisma:client:libraryEngine library starting
prisma:client:libraryEngine library started
prisma:client:libraryEngine library starting
prisma:client:libraryEngine library started
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true

Client Snippet

async userByAddress(address: string): Promise<User> {
        return (await this.prisma.tcUser.findMany({
            where: {
                ethereumAddress: address
            },
        }))[0];
    }

Schema

model TcUser {
  id              Int       @id @default(autoincrement())
  ethereumAddress String?
  active          Boolean
  offers          TcOffer[]

  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  deletedAt DateTime?

  operationBuyer  TcOperation[] @relation("buyer")
  operationSeller TcOperation[] @relation("seller")
}

Prisma Engine Query

{"X":{}}
@pantharshit00
Copy link
Contributor

Hello! Can you please provide a minimal reproduction for the above crash? Unfortunately the automatically collected information in the issue does not give us much to go with here - we will need a bit more information. What were you doing? Can you share the code and schema that was active?

@pantharshit00 pantharshit00 added kind/bug A reported bug. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. topic: basic error report bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Jan 19, 2022
@rafagalan
Copy link
Author

rafagalan commented Jan 19, 2022

The error comes from the execution of any query after executing the 'userByAddress' function (when it does not find anything).
Here is the error when the query does not find any item:

thread 'tokio-runtime-worker' panicked at 'called `Option::unwrap()` on a `None` value', query-engine/core/src/query_document/parser.rs:250:87
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Error: 
Invalid `prisma.tcUser.findUnique()` invocation:


  called `Option::unwrap()` on a `None` value
    at cb (/home/rgalan/Project/blockchain/node_modules/@prisma/client/runtime/index.js:36956:17)
    at UserRepo.user (/home/rgalan/Project/blockchain/packages/server/src/user/user.repo.ts:15:16)
    at UserService.user (/home/rgalan/Project/blockchain/packages/server/src/user/user.service.ts:44:16)
    at UserController.user (/home/rgalan/Project/blockchain/packages/server/src/user/user.controller.ts:36:22)] 
Invalid `prisma.tcUser.findUnique()` invocation:


  called `Option::unwrap()` on a `None` value

After execution any query afterward:

[Error: 
Invalid `prisma.client.findFirst()` invocation:


  PANIC: called `Option::unwrap()` on a `None` value in query-engine/core/src/query_document/parser.rs:250:87

This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.

https://github.com/prisma/prisma/issues/new?body=Hi+Prisma+Team%21+My+Prisma+Client+just+crashed.+This+is+the+report%3A%0A%23%23+Versions%0A%0A%7C+Name++++++++++++%7C+Version++++++++++++%7C%0A%7C-----------------%7C--------------------%7C%0A%7C+Node++++++++++++%7C+v17.0.1++++++++++++%7C+%0A%7C+OS++++++++++++++%7C+debian-openssl-1.1.x%7C%0A%7C+Prisma+Client+++%7C+3.1.0++++++++++++++%7C%0A%7C+Query+Engine++++%7C+0.1.0++++++++++++++%7C%0A%7C+Database++++++++%7C+mysql++++++++++++++%7C%0A%0A%0A%0A%23%23+Logs%0A%60%60%60%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B19s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B11s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B3s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A%60%60%60%0A%0A%23%23+Client+Snippet%0A%60%60%60ts%0A%2F%2F+PLEASE+FILL+YOUR+CODE+SNIPPET+HERE%0A%60%60%60%0A%0A%23%23+Schema%0A%60%60%60prisma%0A%2F%2F+PLEASE+ADD+YOUR+SCHEMA+HERE+IF+POSSIBLE%0A%60%60%60%0A%0A%23%23+Prisma+Engine+Query%0A%60%60%60%0A%7B%22X%22%3A%7B%7D%7D%0A%60%60%60%0A&title=PANIC%3A+called+%60Option%3A%3Aunwrap%28%29%60+on+a+%60None%60+value+in+query-engine%2Fcore%2Fsrc%2Fquery_document%2Fparser.rs%3A250%3A87&template=bug_report.md

If you want the Prisma team to look into it, please open the link above 🙏
To increase the chance of success, please post your schema and a snippet of
how you used Prisma Client in the issue. 

    at cb (/home/rgalan/Project/blockchain/node_modules/@prisma/client/runtime/index.js:36960:17)
    at ApiKeyAuthGuard.canActivate (/home/rgalan/Project/blockchain/packages/server/src/auth/apiKey-auth.guard.ts:19:24)
    at GuardsConsumer.tryActivate (/home/rgalan/Project/blockchain/packages/server/node_modules/@nestjs/core/guards/guards-consumer.js:16:17)
    at canActivateFn (/home/rgalan/Project/blockchain/packages/server/node_modules/@nestjs/core/router/router-execution-context.js:134:33)
    at /home/rgalan/Project/blockchain/packages/server/node_modules/@nestjs/core/router/router-execution-context.js:42:31
    at /home/rgalan/Project/blockchain/packages/server/node_modules/@nestjs/core/router/router-proxy.js:9:17] 
Invalid `prisma.client.findFirst()` invocation:


  PANIC: called `Option::unwrap()` on a `None` value in query-engine/core/src/query_document/parser.rs:250:87

This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.

https://github.com/prisma/prisma/issues/new?body=Hi+Prisma+Team%21+My+Prisma+Client+just+crashed.+This+is+the+report%3A%0A%23%23+Versions%0A%0A%7C+Name++++++++++++%7C+Version++++++++++++%7C%0A%7C-----------------%7C--------------------%7C%0A%7C+Node++++++++++++%7C+v17.0.1++++++++++++%7C+%0A%7C+OS++++++++++++++%7C+debian-openssl-1.1.x%7C%0A%7C+Prisma+Client+++%7C+3.1.0++++++++++++++%7C%0A%7C+Query+Engine++++%7C+0.1.0++++++++++++++%7C%0A%7C+Database++++++++%7C+mysql++++++++++++++%7C%0A%0A%0A%0A%23%23+Logs%0A%60%60%60%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3AtryLoadEnv+Environment+variables+not+found+at+null++%0A++prisma%3AtryLoadEnv+Environment+variables+loaded+from+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fpackages%2Fserver%2F.env++%0A++prisma%3Aclient+clientVersion%3A+3.1.0++%0A++prisma%3Aclient%3AlibraryEngine+internalSetup++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+Search+for+Query+Engine+Library+in+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient++%0A++prisma%3Aclient%3AlibraryEngine+loadEngine+using+%2Fhome%2Frgalan%2FProject%2Fblockchain%2Fnode_modules%2F.prisma%2Fclient%2Flibquery_engine-debian-openssl-1.1.x.so.node++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+library+starting++%0A++prisma%3Aclient%3AlibraryEngine+library+started++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B19s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B11s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%2B3s%0A++prisma%3Aclient%3AlibraryEngine+sending+request%2C+this.libraryStarted%3A+true++%0A%60%60%60%0A%0A%23%23+Client+Snippet%0A%60%60%60ts%0A%2F%2F+PLEASE+FILL+YOUR+CODE+SNIPPET+HERE%0A%60%60%60%0A%0A%23%23+Schema%0A%60%60%60prisma%0A%2F%2F+PLEASE+ADD+YOUR+SCHEMA+HERE+IF+POSSIBLE%0A%60%60%60%0A%0A%23%23+Prisma+Engine+Query%0A%60%60%60%0A%7B%22X%22%3A%7B%7D%7D%0A%60%60%60%0A&title=PANIC%3A+called+%60Option%3A%3Aunwrap%28%29%60+on+a+%60None%60+value+in+query-engine%2Fcore%2Fsrc%2Fquery_document%2Fparser.rs%3A250%3A87&template=bug_report.md

If you want the Prisma team to look into it, please open the link above 🙏
To increase the chance of success, please post your schema and a snippet of
how you used Prisma Client in the issue

@dpetrick
Copy link
Contributor

dpetrick commented Jun 1, 2022

3.15 will ship a change that returns a structured error instead of a panic.

@dpetrick dpetrick closed this as completed Jun 1, 2022
@janpio janpio added this to the 3.15.0 milestone Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. domain/client Issue in the "Client" domain: Prisma Client, Prisma Studio etc. kind/bug A reported bug. topic: basic error report
Projects
None yet
Development

No branches or pull requests

4 participants