Assertion Failed error when using SwitchCurrentActionMap

While trying to use input subscription events to close UI and switch between an action map for the player (PlayerView) and action map for spaceship weapon control (WeaponView), I encounter an Assertion failed error.

The below function is called through subscription to a button action bound to keyboard “ESC” key to switch from PlayerView to WeaponView (which works fine).

8177957--1064885--upload_2022-6-3_15-47-13.png

however when switching from WeaponView to PlayerView it throws the below error:

below is the function used to toggle the UI:

8177957--1064888--upload_2022-6-3_15-49-34.png

Through testing, for some reason the error is only fired when both the SetActive for the UI GameObject prefab and the SwitchCurrentActionMap occurs in the same frame. After the error fires, the action map remains at the previous one, i.e. it doesnt change, remaining at WeaponView.
This also freezes all input, even the movement input (which is handled by another actionmap which is enabled separately and kept on always).

However, upon pressing “ESC” key again movement returns and the WeaponView correctly switches to PlayerView).

Any idea what’s going on here?

Upon further testing, seems like the error still occurs regardless of the SetActive for the UI GameObject, which means that the issue is solely to do with the switching of the action map… Strange, as im using it according to its intended purpose…