You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Realtime Database Android: keepSynced(true) followed by get() causes AssertionError "listen() called twice for same QuerySpec" #8433
Your example works for me too. The issue does not happen on the first call.
The difference is that in my app keepSynced(true) is called again on the same DatabaseReference after the previous sync state already exists.
I can reproduce it consistently only when the same reference is reused/recreated and keepSynced(true) is invoked again after the first successful sync.
java.lang.RuntimeException: Uncaught exception in Firebase Database runloop (22.0.1)
Caused by:
java.lang.AssertionError:
hardAssert failed: listen() called twice for same QuerySpec
Thank you for clarification and additional details @chodnagho. I was able to reproduce the issue. I'll raise this to our engineers and see what we can do here. Thanks!
Thank you, lehcar09. It's quite ironic that I caught this issue while it went unnoticed for so long in a Google-maintained SDK. For a company with Google's resources, that's genuinely surprising.
Activity
lehcar09 commentedon Jul 17, 2026
Hi @chodnagho, thank you for reaching out. I tried reproducing the issue, however, I can't seem to encounter the error you shared.
Here's the code I used:
And I'm also using BoM 34.16.0. Did I forget something here?
chodnagho commentedon Jul 17, 2026
Hi @lehcar09, thanks for checking.
Your example works for me too. The issue does not happen on the first call.
The difference is that in my app
keepSynced(true)is called again on the sameDatabaseReferenceafter the previous sync state already exists.I can reproduce it consistently only when the same reference is reused/recreated and
keepSynced(true)is invoked again after the first successful sync.Steps to reproduce:
Code:
The first time works correctly.
Close the dialog/activity.
Open the same dialog/activity again.
The same code runs again:
The second time the app crashes.
Crash:
Relevant stack:
Environment:
The important part seems to be repeated
keepSynced(true)calls on the same path during the app lifecycle.Using:
does not reproduce the crash in the same flow.
I did not enable Firebase persistence. This happens with
keepSynced(true)only.I hope this additional lifecycle detail helps reproduce the issue.
lehcar09 commentedon Jul 20, 2026
Thank you for clarification and additional details @chodnagho. I was able to reproduce the issue. I'll raise this to our engineers and see what we can do here. Thanks!
chodnagho commentedon Jul 31, 2026
Thank you, lehcar09. It's quite ironic that I caught this issue while it went unnoticed for so long in a Google-maintained SDK. For a company with Google's resources, that's genuinely surprising.
mvanhorn commentedon Aug 20, 2026
Implemented in #8544.