Changing site:mode throws Twig memory error I am trying to toggle the site mode for a new Drupal 8 development site. When I run the command drupal site:mode dev I get the following error:

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 1038876672 bytes) in phar:///usr/local/bin/drupal/vendor/twig/twig/lib/Twig/Extension/Debug.php on line 56


Increasing the memory (even to something huge) doesn't resolve this. Is Twig trying to throw an error, or output loads of data? How can I fix this please?
You're debugging an entity or other object somewhere that has recursive references and debug gets into an endless recursion until all memory is used up.

Instead of debug(node) or similar, use debug(node.toArray()), that gives you the raw value instead of huge object structures.