A valid ESP32 sketch would uplaod without error about the beginning of the year - Now giving error codes

Generally these issues arises due to upgradation of Libraries and Board Compliers.

Downgrade to ESP32 ver 2 instead of current 3 version.

I have not reviewed your Error file / Code, just sharing from experience , I had to downgrade for few old codes