After installation of recent updates for SharePoint (SP2016, SP2019, SPSE) users may receive an HTTP 500 error with the following additional details:
“Cannot read configuration file because it exceeds the maximum file size”
April 2024 CU includes a fix which removes the existing duplicate configuration elements from the web.config and prevents future duplicates from being added.