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

called Option::unwrap() on a None value #21974

Open
focux opened this issue Nov 15, 2023 · 1 comment
Open

called Option::unwrap() on a None value #21974

focux opened this issue Nov 15, 2023 · 1 comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: nested read https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-reads topic: rust panic topic: unwrap error

Comments

@focux
Copy link

focux commented Nov 15, 2023

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

My schema has more than 5.5k lines so I don't think it's going to be helpful but I was able to figure out how this happens. This is the query that I'm running:

await this.prismaService.event
            .findUniqueOrThrow({ where: { id: eventId } })
            .playerStatuses({
              where: { status: EventPlayerStatusType.In },
              include: {
                playerTeam: {},
              },
            });

And if I comment out this part, I don't get the error anymore:

 include: {
    playerTeam: {},
},

Also, not sure if this is helpful but this is the relation that I'm trying to include:

 playerTeam  PlayerTeam?           @relation(fields: [playerId, teamId, seasonId], references: [playerId, teamId, seasonId])

When I enable the query logging, this is the last query that get logged before the panicking — it's the relation query:

SELECT `redacted`.`players_teams`.`id`, `redacted`.`players_teams`.`t_player_id`, `redacted`.`players_teams`.`t_team_id`, `redacted`.`players_teams`.`t_season_id` FROM `redacted`.`players_teams` WHERE (1=1 AND (`redacted`.`players_teams`.`t_player_id`,`redacted`.`players_teams`.`t_team_id`,`redacted`.`players_teams`.`t_season_id`) IN ((?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?),(?,?,?)))

Also, at the start of the error message we see this:

thread 'tokio-runtime-worker' panicked at query-engine/core/src/interpreter/query_interpreters/nested_read.rs:232:50:

Versions

Name Version
Node v18.18.1
OS darwin-arm64
Prisma Client 5.6.0
Query Engine e95e739751f42d8ca026f6b910f5a2dc5adeaeee
Database mysql

Logs

g 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
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
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
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 requestBatch
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 requestBatch
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
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
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
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
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 requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:request_handler {"name":"PrismaClientRustPanicError","clientVersion":"5.6.0"}
prisma:client:request_handler {"name":"PrismaClientRustPanicError","clientVersion":"5.6.0"}
prisma:client:request_handler {"name":"PrismaClientRustPanicError","clientVersion":"5.6.0"}
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine requestBatch
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
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine requestBatch
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
prisma:client:libraryEngine requestBatch
prisma:client:libraryEngine sending request, this.libraryStarted: true
prisma:client:libraryEngine sending request, this.libraryStarted: true

Client Snippet

// PLEASE FILL YOUR CODE SNIPPET HERE

Schema

// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE

Prisma Engine Query

{"X":true}}}
@focux
Copy link
Author

focux commented Nov 15, 2023

Looks like my error was related to these issues:
#21219
#13340

Not having a unique index on the relation. Not sure if I should leave this issue open but would be good to improve the error message there, I spent a day trying to figure out what was causing the bug.

@Weakky Weakky added kind/bug A reported bug. tech/engines Issue for tech Engines. team/client Issue for team Client. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Nov 17, 2023
@Jolg42 Jolg42 added topic: rust panic topic: nested read https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-reads labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. team/client Issue for team Client. tech/engines Issue for tech Engines. topic: nested read https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#nested-reads topic: rust panic topic: unwrap error
Projects
None yet
Development

No branches or pull requests

4 participants