I was in the same situation.
I failed to update the board definitions that were already installed on Arduino IDE 1.8.19.
Eventually, reinstalling the board definitions solved the problem.
Specifically, I uninstalled the M5Stack board definitions on Arduino IDE 2.0, then added the URL for the board definitions, restarted the IDE, and then installed the M5Stack board definitions, which was successful.