The issue occurs because you're calling focusRequester.requestFocus() before the AnimatedVisibility composable has completed its composition and placed the TextField in the composition tree. This results in a java.lang.IllegalStateException since the focusRequester hasn't been properly attached yet.