When I try to translate a menu item in the Main Navigation menu the site crashes with a cryptic message. I am able to go back to home and start again but this bug repeats itself every time I try to do this same operation. I have installed Varbase numerous time including the dev version and all exhibit the same behaviour.

Comments

michael.stamler created an issue. See original summary.

RajabNatshah’s picture

Assigned: Unassigned » RajabNatshah
Status: Active » Needs work

Thanks Michael for reporting this issue.

I was able to reproduce the issue, and I got the following error message:

The website encountered an unexpected error. Please try again later.InvalidArgumentException: Field content_translation_source is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 509 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Drupal\Core\Entity\ContentEntityBase->get('content_translation_source') (Line: 44)
Drupal\content_translation\ContentTranslationMetadataWrapper->getSource() (Line: 115)
Drupal\content_translation\Controller\ContentTranslationController->Drupal\content_translation\Controller\{closure}('en')
array_filter(Array, Object) (Line: 117)
Drupal\content_translation\Controller\ContentTranslationController->overview(Object, 'menu_link_content')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 576)
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: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
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: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Troubleshooting issues with the content_translation module.

RajabNatshah’s picture

Title: Translation causes site crash » Translation: Main Navigation menu Translation causes an error message of website encountered an unexpected error. Field content_translation_source is unknown.
michael.stamler’s picture

I also got the following log:
The website encountered an unexpected error. Please try again later.InvalidArgumentException: Field content_translation_source is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 509 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Drupal\Core\Entity\ContentEntityBase->get('content_translation_source') (Line: 44)
Drupal\content_translation\ContentTranslationMetadataWrapper->getSource() (Line: 115)
Drupal\content_translation\Controller\ContentTranslationController->Drupal\content_translation\Controller\{closure}('en')
array_filter(Array, Object) (Line: 117)
Drupal\content_translation\Controller\ContentTranslationController->overview(Object, 'menu_link_content')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 576)
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: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
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: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
michael.stamler’s picture

I have resolved this issue as follows:

In order for menu items to be translatable the 'custom menu link' item in /admin/config/regional/content-language must be enabled and configured. This was missing, probably because the install profile doesn't set it. This caused an exception to be thrown in the ContentTranslationController. When I manually set this then the exception did not occur and I am able to access the translate screen for the menu item.

I tried to find where this is configured in the installation without success.

Please keep me in the loop on how to resolve this issue. I would like to do it to the end, if possible.