The issue happens in all cases when Symfony's Security Component has not been initialised yet, for instance, when any router throws exception.
Steps to reproduce
- Create own ExceptionController
- Configure Twig to use custom ExceptionController
- In the custom controller try to render template. In template try to do:
where locationId is some existing location.
- You should see 500 error and exception like Token not found in token storage....