Investigating a Recursive Router Rebuild Error During Drupal 11 Upgrade Testing
Automated regression tests for a Drupal 11 upgrade exposed an installation failure that appeared unrelated to custom project code. In a ComputerMinds article published on 2 June 2026, James Williams described how a Recursive router rebuild detected exception surfaced during Drupal installation inside a DDEV-based GitHub Actions testing environment. The tests used phpunit, a custom install profile, and a fresh site installation to validate project behaviour during the upgrade.
Instead of treating the active exception stack as the full story, James used PHP’s debug_backtrace() function to store earlier executions of Drupal core’s route rebuild method in a static variable. That allowed him to inspect what he describes as a “great uncle” call stack, referring to an earlier execution path that had already completed before the later failure occurred. The stored trace showed that an earlier router rebuild had been interrupted by a handled exception, leaving Drupal in a state where a later rebuild triggered the recursive rebuild error.
The investigation traced the earlier rebuild attempt to Drupal core’s menu_link_content module. During configuration imports performed as part of site installation, entity deletions triggered menu link cleanup logic that required route information, causing an unexpected rebuild attempt. James resolved the test failure by using hook_module_implements_alter() to disable the relevant entity_predelete hook implementation during installation, presenting the case as both a specific Drupal 11 upgrade fix and a reusable debugging technique for complex control-flow problems.


