This error usually means the uploaded firmware didn't flash correctly. Try these steps:
Use a different USB cable and port.
Press the reset button on your M5Stack before uploading.
Make sure you have the latest Arduino M5Stack libraries and board definitions.
Try erasing the flash completely using esptool (esptool.py erase_flash).
Reboot your PC and M5Stack.
If it persists, it could be a hardware fault, but most often it’s a flashing or connection issue.