After upgrading to Drupal core 8.1.10, I cannot edit nodes with user id 1 nor can nodes be translated by any user.

The log error is as follows:

Type: php
Drupal\Core\Entity\EntityStorageException: Invalid translation language (de) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (Zeile 770 in /core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

If I uninstall Solr Search Multilingual, Solr Search, Database Search and Database Search Defaults, the above error goes away and I can edit nodes with user id 1 and all users can edit and translate nodes.

If I re-enable Database Search and Databse Search Defaults and re-index the site, I get a message on the index status page: "Couldn't index items. Check the logs for details."

The log error is as follows:

Type: search_api

InvalidArgumentException: Invalid translation language (de) specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (Zeile 745 in /core/lib/Drupal/Core/Entity/ContentEntityBase.php).

There is a similar unresolved issue here, which is three years old: https://www.drupal.org/node/2137815

This happened on a site which should go live soon with four languages with German as the default. I have about 60 nodes, of which 2-3 are translated into English.

Any information on how to fix this would very much appreciated.

Comments

criscom created an issue. See original summary.

criscom’s picture

Issue summary: View changes
drunken monkey’s picture

Component: Database backend » Framework
Priority: Critical » Normal

Firstly, did you try updating to the latest dev (or Beta 3) version of this module?
Also, Drupal 8.1 has already reached end-of-life, so maybe try updating to Drupal 8.2, too.

If none of that helps, it would help immensely if you could manage to get a backtrace for that exception. For that, go to admin/config/development/logging and set "Error messages to display" to "All messages, with backtrace information". (Not completely sure – if that's not enough, try enabling XDebug for your server's PHP and/or install the Drupal Devel module. One of these should do it.)

If you also can't create a new index, this eliminates my primary suspect for this problem, i.e., update problems between module versions. What exactly happens if you try to create a new index with the "Content" datasource? (I expect it works fine when creating an index with other datasources?)

drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)
criscom’s picture

Hi Thomas,

thanks for you reply.

First and foremoste here is the backtrace:

Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es später nochmal.

Drupal\Core\Entity\EntityStorageException: Invalid translation language (de) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 772 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\search_api\Utility\FieldsHelper->extractFields(Object, Array, 'de') (Line: 143)
Drupal\search_api\Utility\FieldsHelper->extractFields(Object, Array, 'de') (Line: 148)
Drupal\search_api\Utility\FieldsHelper->extractFields(Object, Array, 'de') (Line: 93)
Drupal\search_api\Utility\Utility::extractFields(Object, Array, 'de') (Line: 239)
Drupal\search_api\Item\Item->getFields() (Line: 164)
Drupal\search_api\Plugin\search_api\processor\ContentAccess->addFieldValues(Object) (Line: 245)
Drupal\search_api\Item\Item->getFields() (Line: 951)
Drupal\search_api\Entity\Index->indexSpecificItems(Array) (Line: 1054)
Drupal\search_api\Entity\Index->trackItemsInsertedOrUpdated('entity:node', Array, 'trackItemsUpdated') (Line: 1026)
Drupal\search_api\Entity\Index->trackItemsUpdated('entity:node', Array) (Line: 298)
search_api_node_access_records_alter(Array, Object, NULL) (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('node_access_records', Array, Object) (Line: 151)
Drupal\node\NodeAccessControlHandler->acquireGrants(Object) (Line: 137)
Drupal\node\Entity\Node->postSave(Object, 1) (Line: 469)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 304)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 395)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 762)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 356)
Drupal\node\NodeForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 583)
Drupal\Core\Form\FormBuilder->processForm('node_page_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I will try to update Drupal core to 8.2 tonight. The currently installed version of SearchAPI is 8.x-1.0-beta2. I will update SearchAPI to the latest dev tonight, too.

Thanks for your support! Very much appreciated!

drunken monkey’s picture

Thanks for providing the backtrace!
This seems like the same issue that was reported (and, consequently, resolved) in #2684465-18: Taxonomy terms are not indexed as expected for multilingual sites. . Updating the Search API module should fix it.

criscom’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks Thomas!

Yes, updating to Drupal 8.1.2 and SearchAPI Beta 3 fixed the issue. Since composer didn't work for my update fom 8.1.10 to 8.1.2 I had to manually download the latest Drupal version and replace the core/ and vendor/ folders. Then I ran composer update and composer require.

wget https://ftp.drupal.org/files/projects/drupal-8.2.1.zip
        unzip drupal-8.2.1.zip
        mv drupal-8.2.1/core .
        mv drupal-8.2.1/vendor/ .
        composer update
        drush updb
        drush entup

Great support, thanks a lot, Thomas! (I feared updating to 8.1.2 would make matters worse - so wrong)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pyxio’s picture

i am having the same issue with version 8.x-1.4 using the drupal commerce composer installation base.
InvalidArgumentException: Invalid translation language (cs) specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (line 783 of /var/www/html/ergodesk/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).