Turns out I was navigating to another page immediately and popping this fragment from back stack. But the fragment wasn't immediately getting destroyed. Hence the exception was thrown if I accessed the viewmodel in that state. So to resolve it I simply did not use the viewmodel if I am to navigate to another place.