TYPO3 Exception 1442236317 

TYPO3 13.4 

Exception Message
(1/1) #1442236317 InvalidArgumentException

MenuItem "" is not valid
in /var/www/html/vendor/typo3/cms-backend/Classes/Template/Components/Menu/Menu.php line 92
Copied!

Situation 

This exception appears when creating a backend module with submodules and you have no title for submodule, i.e.:

  • wrong translation key/path in <ext>/Configuration/Backend/Modules.php for submodule title
  • translation key doesn't exists in translation file
  • language cache has not been cleared (clear all cache)

Solution 

Check all submodules titles and clear all cache.

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.

One possible reason for Href being empty: the action is missing in Configuration/Backend/Modules.php -> 'ControllerActions'

Solution 

Fix the href generation.