How do you fix the “Area code is not set” error?
That error means code touched a frontend or adminhtml resource before Magento set an area, almost always in a custom CLI command, a cron job, or a setup/data patch. We trace the offending class, set the correct area with State::setAreaCode() or the right DI emulation, and confirm the command, cron and any related API all resolve cleanly. Then we add a check so it can’t silently reappear after the next deploy.