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.

PANIC in query-engine\core\src\response_ir\internal.rs:398:26Application logic invariant error: received null value for field user which may not be null

See original GitHub issue

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

Versions

Name Version
Node v12.16.3
OS undefined
Prisma Client 2.19.0
Query Engine query-engine c1455d0b443d66b0d9db9bcb1bb9ee0d5bbc511d
Database undefined

Query

query {
  findManyProfile(
    take: 5
    skip: 5
  ) {
    id
    bio
    user {
      id
      email
      name
    }
    userId
  }
}

Logs

%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&title=PANIC+in+query-engine%5Ccore%5Csrc%5Cresponse_ir%5Cinternal.rs%3A398%3A26%0AApplication+logic+invariant+error%3A+received+null+value+for+field+user+which+may+not+be+null&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 NodeEngine.throwAsyncErrorIfExists (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29776:21)
    at NodeEngine.handleRequestError (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29115:16)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async NodeEngine.request (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29710:9)
    at async cb (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:34744:26)
    at async C:\Users\Administrator\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:133:35
    at async C:\Users\Administrator\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:106:32
    at async PCW.request (C:\Users\Administrator\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\node_modules\@prisma\studio-pcw\build\pcw.js:173:46)
    at async IpcMainImpl.prisma (C:\Users\Administrator\AppData\Local\Programs\@prismastudio-electron\resources\app.asar\build\ipc\prisma-ipc.js:72:34)
prisma:engine Client Version: 2.19.0
prisma:engine Engine Version: query-engine c1455d0b443d66b0d9db9bcb1bb9ee0d5bbc511d
prisma:engine Active provider: mysql
prisma:engine There is a child that still runs and we want to start again
prisma:engine { cwd: 'C:\\project\\my-prisma\\prisma' }
prisma:engine {
  flags: [
    '--enable-experimental=createMany',
    '--enable-raw-queries',
    '--port',
    '62064'
  ]
}
prisma:engine stdout  Starting a mysql pool with 9 connections.
prisma:engine stdout  Started http server on http://127.0.0.1:62064
prisma:engine Client Version: 2.19.0
prisma:engine Engine Version: query-engine c1455d0b443d66b0d9db9bcb1bb9ee0d5bbc511d
prisma:engine Active provider: mysql
prisma:engine stdout  PANIC in query-engine\core\src\response_ir\internal.rs:398:26
Application logic invariant error: received null value for field user which may not be null
prisma:engine {
  error: Error: read ECONNRESET
      at TCP.onStreamRead (internal/stream_base_commons.js:205:27) {
    errno: 'ECONNRESET',
    code: 'ECONNRESET',
    syscall: 'read'
  }
}
prisma:engine {
  error: Error: connect ECONNREFUSED 127.0.0.1:62064
      at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
    errno: 'ECONNREFUSED',
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 62064
  }
}
prisma:engine There is a child that still runs and we want to start again
prisma:engine { cwd: 'C:\\project\\my-prisma\\prisma' }
prisma:engine {
  flags: [
    '--enable-experimental=createMany',
    '--enable-raw-queries',
    '--port',
    '62074'
  ]
}
prisma:engine stdout  Starting a mysql pool with 9 connections.
prisma:engine stdout  Started http server on http://127.0.0.1:62074
prisma:engine stdout  PANIC in query-engine\core\src\response_ir\internal.rs:398:26
Application logic invariant error: received null value for field user which may not be null
prisma:engine TypeError: this.currentRequestPromise.cancel is not a function
    at NodeEngine.handlePanic (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29249:36)
    at NodeEngine.setError (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29195:16)
    at LineStream.<anonymous> (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:29480:24)
    at LineStream.emit (events.js:310:20)
    at addChunk (_stream_readable.js:286:12)
    at readableAddChunk (_stream_readable.js:268:9)
    at LineStream.Readable.push (_stream_readable.js:209:10)
    at LineStream.Transform.push (_stream_transform.js:152:32)
    at LineStream._pushBuffer (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:26388:19)
    at LineStream._transform (C:\Users\Administrator\AppData\Roaming\@prisma\studio-electron\projects\090830d3\runtime\index.js:26382:10)  {"timestamp":"May 19 12:19:50.219","level":"ERROR","fields":{"message":"PANIC","reason":"Application logic invariant error: received null value for field user which may not be null","file":"query-engine\\core\\src\\response_ir\\internal.rs","line":398,"column":26},"target":"query_engine","span":{"name":"execute_single_operation"},"spans":[{"name":"execute_single_operation"}]}
prisma:engine {
  error: Error: read ECONNRESET
      at TCP.onStreamRead (internal/stream_base_commons.js:205:27) {
    errno: 'ECONNRESET',
    code: 'ECONNRESET',
    syscall: 'read'
  }
}

Client Snippet

This example is available because a nonexistent userid was created. Prism studio not available after error

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String   @db.VarChar(255)
  content   String?
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
}

model Profile {
  id     Int     @id @default(autoincrement())
  bio    String?
  user   User    @relation(fields: [userId], references: [id])
  userId Int     @unique
}

model User {
  id      Int      @id @default(autoincrement())
  email   String   @unique
  name    String?
  posts   Post[]
  profile Profile?
}
import { PrismaClient } from '@prisma/client'

const prisma = new PrismaClient()

async function main() {
  let create = await prisma.profile.create({
    data: {
      bio: "hi~",
      userId: 0
    }
  })
  console.log(create)
}

main()
  .catch((e) => {
    console.log(e)
    throw e
  })
  .finally(async () => {
    await prisma.$disconnect()
  })

Schema

// PLEASE ADD YOUR SCHEMA HERE IF POSSIBLE

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
WoJiaoFuXiaoYuncommented, May 19, 2021

Can you provide some context here @viphehe? The Prisma Client Query or the Schema would be very helpful.

@janpio Has been re edited

0reactions
pantharshit00commented, Jun 2, 2022

I am going to close this as its been 3 months now and there is no activity here.

Please reply if you want us to take another look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PANIC: Application logic invariant error: received null value for ...
Hi Prisma Team! My Prisma Client just crashed. This is the report: Versions Name Version Node v10.18.1 OS darwin Prisma Client 2.8.0 Logs ......
Read more >
Flow failing due to 'Null' value - Power Platform Community
I've tried the following unsuccessfully (all provide the exact same error if no value is entered in the 'Due_Date' field when the new...
Read more >
Started react native a couple weeks ago, can someone please ...
Started react native a couple weeks ago, can someone please help me with this error: Invariant Violation: Native module cannot be null.
Read more >
how to achieve "if field value is NOT null" logic - ServiceNow
To make a long story short, I've tried a number of things and am unable to create and IF branch in a flow...
Read more >
Should one check for null if he does not expect null?
Personally, I would say: The generic exception is best if the error condition would be a sign of a serious bug in your...
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