Sigala's Blog

How to fix "TYPO3\CMS\Core\Context\LanguageAspectFactory::createFromSiteLanguage(): Argument #1 ($language) must be of type TYPO3\CMS\Core\Site\Entity\SiteLanguage, null given, called in ..." error

Published

The full error message is:

TYPO3\CMS\Core\Context\LanguageAspectFactory::createFromSiteLanguage(): Argument #1 ($language) must be of type TYPO3\CMS\Core\Site\Entity\SiteLanguage, null given, called in /var/www/html/vendor/typo3/cms-frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php on line 593

This post will show you how to fix the error above.

Cause

This error occured because at the languages property/option of the LanguageMenuProcessor in your site's TypoScript configuration,
a language ID specified in the list of comma-separated IDs is not found in the website's Site Configuration.

 

Solution

The solution is to set the languages property of the LanguageMenuProcessor to auto.

This way, the language IDs to use are loaded from the site configuration.