TYPO3 Exception 1442236317

TYPO3 12.4.17 - 29.07.2024

caption: Exception Message

MenuItem "" is not valid
Copied!

Situation

Right after an update from TYPO3 11 to 12. Forgot to clear the cache

Solution

Clear all caches from install tool or console

TYPO3 12.4.14 - 17.05.2024

caption: Exception Message

MenuItem "Liste" is not valid
Copied!

Situation

Trying to add a menu Item to the menu in a custom backend module:

EXT:my_extension/Classes/Controller/MyModuleController.php
$menu = $moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();

 $menuItem = $menu->makeMenuItem()
    ->setTitle($menuItemConfig['label'])
    ->setHref($this->uriBuilder->reset()->uriFor($menuItemConfig['action'], [], $menuItemConfig['controller']))
    ->setActive($isActive);
$menu->addMenuItem($menuItem);
Copied!

This exception is thrown when the title or the href of the menuitem are empty. In this case the UriBuilder returned an emptry result, therefore the Href was empty.

Solution

Fix the href generation.