Locate in an action gives an error when nothing is selected
Layers panel has a 'Locate Object' command in its menu.
It can be recorded into an action directly, without messing with the Actions’ 'Insert Menus Item...' workaround approach.
However, when this recorded action is called with no selection made, Ai throws an error (!):
The action failed with an unexpected error code.
...if there is nothing to locate, locate nothing. But an error is too harsh, it breaks workflows.