Skip to content

PANIC in query-engine/core/src/query_graph_builder/read/utils.rs:52:85called Result::unwrap() on an Err value: FieldNotFound { name: "_count", model: "Book" } #7151

Closed

Description

@grzelakc

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

Versions

Name Version
Node v12.17.0
OS darwin
Prisma Client 2.22.1
Query Engine query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c
Database undefined

Query

query {
  findManyPublisher(where: {
    id: "X"
  }) {
    id
    name
    description
    books {
      id
      title
      publisherId
      _count {
        reviews
      }
    }
  }
}

Logs

ma/client  
  plusX Execution permissions of /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client/query-engine-darwin are fine  
  plusX Execution permissions of /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '58522' ] }  
  prisma:engine stdout  Starting a postgresql pool with 9 connections.  
  prisma:engine stdout  Fetched a connection from the pool  
  prisma:engine stdout  Started http server on http://127.0.0.1:58522  
  prisma:engine Search for Query Engine in /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client  
  plusX Execution permissions of /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine stdout  Fetched a connection from the pool  
  prisma:engine stdout  PANIC in query-engine/core/src/query_graph_builder/read/utils.rs:52:85
called `Result::unwrap()` on an `Err` value: FieldNotFound { name: "_count", model: "Book" }  
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/@prisma/client/runtime/index.js:25530:24)
  prisma:engine       at Socket.emit (events.js:327:22)
  prisma:engine       at Socket.EventEmitter.emit (domain.js:482:12)
  prisma:engine       at endReadableNT (_stream_readable.js:1221:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine }  
  prisma:engine Client Version: 2.22.1  
  prisma:engine Engine Version: query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c  
  prisma:engine Active provider: postgresql  
  prisma:engine {
  prisma:engine   error: Error: connect ECONNREFUSED 127.0.0.1:58522
  prisma:engine       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
  prisma:engine     errno: 'ECONNREFUSED',
  prisma:engine     code: 'ECONNREFUSED',
  prisma:engine     syscall: 'connect',
  prisma:engine     address: '127.0.0.1',
  prisma:engine     port: 58522
  prisma:engine   }
  prisma:engine }  
  prisma:engine {
  prisma:engine   cwd: '/Users/cgrzelak/workspace/playground/prismatest/starter/prisma'
  prisma:engine }  
  prisma:engine Search for Query Engine in /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client  
  plusX Execution permissions of /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine { flags: [ '--enable-raw-queries', '--port', '58526' ] }  
  prisma:engine stdout  Starting a postgresql pool with 9 connections.  
  prisma:engine stdout  Fetched a connection from the pool  
  prisma:engine stdout  Started http server on http://127.0.0.1:58526  
  prisma:engine Search for Query Engine in /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client  
  plusX Execution permissions of /Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/.prisma/client/query-engine-darwin are fine  
  prisma:engine stdout  Fetched a connection from the pool  
  prisma:engine stdout  PANIC in query-engine/core/src/query_graph_builder/read/utils.rs:52:85
called `Result::unwrap()` on an `Err` value: FieldNotFound { name: "_count", model: "Book" }  
  prisma:engine {
  prisma:engine   error: SocketError: other side closed
  prisma:engine       at Socket.onSocketEnd (/Users/cgrzelak/workspace/playground/prismatest/starter/node_modules/@prisma/client/runtime/index.js:25530:24)
  prisma:engine       at Socket.emit (events.js:327:22)
  prisma:engine       at Socket.EventEmitter.emit (domain.js:482:12)
  prisma:engine       at endReadableNT (_stream_readable.js:1221:12)
  prisma:engine       at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  prisma:engine     code: 'UND_ERR_SOCKET'
  prisma:engine   }
  prisma:engine }  

Client Snippet

async function main() {
  const result = await prisma.publisher.findMany({
    where: {
      id: "f0798c84-d302-4a6c-bb0c-e82ff2c00941",
    },
    include: { books: { include: { _count: { select: { reviews: true } } } } },
  });

  console.log(result);
}

Schema

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")

}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["selectRelationCount"]
}

model Publisher {
  id          String @id @default(uuid()) @db.Uuid
  name        String
  description String
  books       Book[]
}

model Book {
  id          String     @id @default(uuid()) @db.Uuid
  title       String
  reviews     Review[]
  Publisher   Publisher? @relation(fields: [publisherId], references: [id])
  publisherId String?    @db.Uuid
}

model Review {
  id      String  @id @default(uuid()) @db.Uuid
  content String?
  Book    Book?   @relation(fields: [bookId], references: [id])
  bookId  String? @db.Uuid
}

Activity

  1. added
    bug/1-unconfirmed
    kind/bug
    on May 19, 2021
  2. pantharshit00 commented on May 20, 2021

    @pantharshit00
    Contributor

    I can reproduce this with 2.24.0-dev.6. Thanks for the details @grzelakc

  3. added
    bug/2-confirmed
    and removed
    bug/1-unconfirmed
    on May 20, 2021
  4. removed their assignment
    on May 20, 2021
  5. janpio commented on May 22, 2021

    @janpio
    Contributor

    This is a duplicate of #6543 Please follow that issue for a fix or information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/2-confirmedkind/bugtopic: basic error reporttopic: selectRelationCount

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions