Invalid translation language (fa) specified I'm trying to add "fa" language in a Drupal 8 installation. I added it from admin/config/regional/language. Everything is OK and the language added successfully and added in language switcher in front-end. But when I click on it, I get this error:

InvalidArgumentException: Invalid translation language (fa) specified. in Drupal\Core\Entity\ContentEntityBase-&gt;getTranslation() (line 748 of core/lib/Drupal/Core/Entity/ContentEntityBase.php). 


Note: This is not a clean installation. The Drupal I have is a working site with some modules which I want to add Persian as its 6th language. Any suggestions?

Thanks.
Basically, this error appears when some translation methods like $entity->getTranslation('LANGUAGE_CODE') or $entity->addTranslation('LANGUAGE_CODE') are called and there is no translation of the entity in the specified language.

The solution is to check if the entity hasTranslation using $entity->hasTranslation('fa') before calling the getTranslation or addTranslation like this:

if ($entity-&gt;hasTranslation('fa')) {
  $translation = $entity-&gt;getTranslation('fa');
}