I know this utility isn't updated anymore, but just for completness (inner satisfaction):
If I execute zenity --info; wmctrl -l then zenity will open a window. If I then press Enter, the zenity window will close and wmctrl will start executing, but fails with the error X Error of failed request: BadWindow (invalid Window parameter).
wmctrl will (1) query a list of all windows and then (2) request further information on each of those windows.
But if a window closes between (1) and (2) like in the example above, wmctrl will fail which is probably not what was intended in such a case.
I'm using Linux Mint 22.2 in case you can't reproduce this bug on another distro.