Upgrade and theme change - pages not found

I redesigned my site with a theme based on Typhoon - so Tailwind and Alpine. To upload the changes to the server I first upgraded GRAV and plugins, then added the new theme & the missing plugins, changed from the old theme to the new one and lastly deleted and re-uploaded the pages folder.

Everything seems to be working fine from the front-end but when I go to edit a page on the admin side I get:

Server Error
Sorry, something went terribly wrong!

0 - An exception has been thrown during the rendering of a template ("Invalid argument supplied for foreach()").
For further details please review your logs/ folder, or enable displaying of errors in your system configuration.

I’ve checked everything I can think of - the licences are there, the system and plugins are all updated, dev and prod are both on php 7.4, I’ve emptied the cache…

The grav log says: An exception has been thrown during the rendering of a template ("Invalid argument supplied for foreach()"). which we already knew…

This is the verbose version:

 /home/invitati/public_html/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array) 
 /home/invitati/public_html/cache/twig/3f/3f8b40dfed0d6bbb52fe074d74af22a310c9532180f1cd8bc928dcb5050defd1.php(64): Twig\Template->display(Array) 
 /home/invitati/public_html/vendor/twig/twig/src/Template.php(453): __TwigTemplate_48b9cf7c72b9b53ca9455cab44c1a1f70a36e9b87916d08b1ab57cd1291bb3d2->doDisplay(Array, Array) 
 /home/invitati/public_html/vendor/twig/twig/src/Template.php(420): Twig\Template->displayWithErrorHandling(Array, Array) 
 /home/invitati/public_html/vendor/twig/twig/src/Template.php(432): Twig\Template->display(Array) 
 /home/invitati/public_html/vendor/twig/twig/src/TemplateWrapper.php(47): Twig\Template->render(Array, Array) 
 /home/invitati/public_html/vendor/twig/twig/src/Environment.php(384): Twig\TemplateWrapper->render(Array) 
 /home/invitati/public_html/system/src/Grav/Common/Twig/Twig.php(435): Twig\Environment->render('flex-objects.ht...', Array) 
 /home/invitati/public_html/system/src/Grav/Common/Service/OutputServiceProvider.php(36): Grav\Common\Twig\Twig->processSite('html') 
 /home/invitati/public_html/vendor/pimple/pimple/src/Pimple/Container.php(118): Grav\Common\Service\OutputServiceProvider->Grav\Common\Service\{closure}(Object(Grav\Common\Grav)) 

all help gratefully received : )