Unique constraint failed on the constraint: `Conversation_latestMessageId_key`

This is my prisma schema

model User {
  id            String          @id @default(auto()) @map("_id") @db.ObjectId
  name          String?
  email         String?         @unique
  emailVerified DateTime?
  image         String?
  username       String?  @unique
  accounts      Account[]
  sessions      Session[]
 messages       Message[]
  conversations  ConversationParticipant[]

 
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
 
model Account {
  id                String  @id @default(auto()) @map("_id") @db.ObjectId
  userId            String  @db.ObjectId
  type              String
  provider          String
  providerAccountId String
  refresh_token     String? @db.String
  access_token      String? @db.String
  expires_at        Int?
  token_type        String?
  scope             String?
  id_token          String? @db.String
  session_state     String?
 
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
 
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
 
  @@unique([provider, providerAccountId])
}
 
model Session {
  id           String   @id @default(auto()) @map("_id") @db.ObjectId
  sessionToken String   @unique
  userId       String   @db.ObjectId
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
 
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
 
model VerificationToken {
  id         String   @id @default(auto()) @map("_id") @db.ObjectId
  identifier String
  token      String
  expires    DateTime
 
  @@unique([identifier, token])
}
 

model Conversation {
  id              String    @id @default(auto()) @map("_id") @db.ObjectId
  participants    ConversationParticipant[]
  messages        Message[] @relation("conversationMessages")
  latestMessage   Message?   @relation(name: "latestConversationMessage", fields: [latestMessageId], references: [id], onUpdate: NoAction, onDelete: NoAction)
  latestMessageId String?    @unique  @db.ObjectId
  createdAt       DateTime  @default(now())
  updatedAt       DateTime  @updatedAt
}

model ConversationParticipant {
  id              String    @id @default(auto()) @map("_id") @db.ObjectId
  user            User      @relation(fields: [userId], references: [id])
  userId          String    @db.ObjectId
  conversation    Conversation @relation(fields: [conversationId], references: [id])
  conversationId  String    @db.ObjectId
  hasSeenLatestMessage Boolean
}

model Message {
  id              String        @id @default(auto()) @map("_id") @db.ObjectId
  conversation    Conversation  @relation(name: "conversationMessages", fields: [conversationId], references: [id])
  conversationId  String        @db.ObjectId
  isLatestIn      Conversation? @relation("latestConversationMessage")
  sender          User          @relation(fields: [senderId], references: [id])
  senderId        String        @db.ObjectId
  body            String
  createdAt       DateTime      @default(now())
  updatedAt       DateTime      @updatedAt
}

When I run the below query:

const conversation = await prisma.conversation.create({
  data: {
    participants: {
      createMany: {
        data: participantIds.map((id) => ({
          userId: id,
          hasSeenLatestMessage: id === userId,
        })),
      },
    },
  },
  include: {
    participants: {
      include: {
        user: {
          select: {
            id: true,
            username: true,
          },
        },
      },
    },
    latestMessage: {
      include: {
        sender: {
          select: {
            id: true,
            username: true,
          },
        },
      },
    },
  },
});

The conversation in created in the mongoDB database when there are 0 entries in conversation model. When I again run the same query with different array of participantIDs it throws this error:

CREATE_CONVERSATION_ERROR:  PrismaClientKnownRequestError: 
Invalid `prisma.conversation.create()` invocation in
D:Practice projectsmessagerbackendsrcgraphqlresolversconversation.ts:22:56

  19 } = session;
  20 
  21 try {
→ 22   const conversation = await prisma.conversation.create(
Unique constraint failed on the constraint: `Conversation_latestMessageId_key`
    at In.handleRequestError (D:Practice projectsmessagerbackendnode_modules@prismaclientruntimelibrary.js:122:6877)
    at In.handleAndLogRequestError (D:Practice projectsmessagerbackendnode_modules@prismaclientruntimelibrary.js:122:6211)
    at In.request (D:Practice projectsmessagerbackendnode_modules@prismaclientruntimelibrary.js:122:5919)
    at async l (D:Practice projectsmessagerbackendnode_modules@prismaclientruntimelibrary.js:127:11167)
    at async Object.createConversation (D:Practice projectsmessagerbackendsrcgraphqlresolversconversation.ts:22:30) {
  code: 'P2002',
  clientVersion: '5.15.0',
  meta: {
    modelName: 'Conversation',
    target: 'Conversation_latestMessageId_key'
  }
}

What am i doing wrong?

The expected result would be:
A conversation being created and related conversationParticipants.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật