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.

thread '<unnamed>' panicked at 'Every RelationInfo should have a complementary RelationInfo on the opposite relation field.'

See original GitHub issue

prisma validate/format crash on this schema:

datasource db {
  provider = "sqlserver"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model Test {
  id         Int        @id
  fk         Int
  testparent TestParent @relation(fields: [fk], references: [id])
}

model TestParent {
  id    Int    @id
  tests Test[]

  fk   Int
  self TestParent @relation(fields: [fk], references: [id])
}

with:

thread '<unnamed>' panicked at 'Every RelationInfo should have a complementary RelationInfo on the opposite relation field.', libs\datamodel\connectors\dml\src\datamodel.rs:165:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: Unexpected token E in JSON at position 0

This is surprising, as usually the missing backrelation validation works fine, e.g. when you only have the second model without the relation to the first one:

model TestParent {
  id    Int    @id
  fk   Int
  self TestParent @relation(fields: [fk], references: [id])
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ChipClarkcommented, Oct 7, 2021

Confirmed fixed in v3.2.1

FYI - this is in production with NestJS 7.6.0

0reactions
janpiocommented, Oct 7, 2021

Can you please confirm this is also fixed for you with 3.2.x @ChipClark?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma 3.3.0 Release - GitClear
ci(publish): take major version into account for calculating patch ... thread '<unnamed>' panicked at 'Every RelationInfo should have a complementary ...
Read more >
Seven Days, June 5, 2019 by Seven Days - Issuu
As state pot laws “Just because you have a card doesn't become more permissive, mean you could do that anywhere,” Rivers some wonder...
Read more >
SELF ASSESSMENT REPORT POST GRADUATE ...
Responsible for IT & other related academic infrastructure. ... Need to complement all management domain with latest IT tools.
Read more >
Jewish Standard, March 11, 2016 - Scribd
know if it will get to that point because ... was crucial to create understanding of, and relationships with, each other.
Read more >
https://oa.upm.es/cgi/search/archive/advanced?outp...
Just we need to print in our clothes the patterns or markers that our ... spa relation: info:eu-repo/grantAgreement/EC/FP7/AFRICA-2010%2F99621 rights: ...
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