Hi their can someone pls provide assistance on what could possible be causing this bug

According to the message, an operation was attempted on a closed database or deleted collection. So first check that the application has not already closed the connection. Then check which collection the operation was performed on, and if that collection exists.

There is not enough of a stack trace there, so that I can figure out what’s going on.

@mreiche is right, just looking at it, that you are attempting to create a query on a database that you’ve closed.

I see that this is happening in a Kotlin Flow, which is, by its nature, asynchronous. Perhaps that’s a clue?