With the 'Media' module enabled and made translatable, when I try to delete the translation of a media there is this error. Note that the translation is in fact removed as it doesn't appear anymore in the translation list.
To reproduce:
- Install drupal 8.5.5 in english
- Enable these modules:
- Core: Media
- Multilingual: Content Translation
- Add a language ( /admin/config/regional/language ) and add the language switcher to one region ( /admin/structure/block )
- Check the 'Media' custom language settings in /admin/config/regional/content-language and make at least one media type translatable (image for instance).
- Add an image (/media/add/image) and translate it (/media/1/translations)
- Delete the translation (for french translation it would be /fr/media/1/delete), once you click the "Delete * translation" the error appear. "The website encountered an unexpected error. Please try again later."
- If you go back to the translation list the translation was in fact removed (/media/1/translations)
Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es später nochmal.</br></br><em class="placeholder">InvalidArgumentException</em>: The entity object refers to a removed translation (de) and cannot be manipulated. in <em class="placeholder">Drupal\Core\Entity\ContentEntityBase->getTranslatedField()</em> (line <em class="placeholder">573</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/ContentEntityBase.php</em>). <pre class="backtrace">Drupal\Core\Entity\ContentEntityBase->get('name') (Line: 92)
Drupal\media\Entity\Media->getName() (Line: 107)
Drupal\media\Entity\Media->label() (Line: 99)
Drupal\Core\Entity\ContentEntityDeleteForm->getDeletionMessage() (Line: 76)
Drupal\Core\Entity\ContentEntityDeleteForm->submitForm(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: 589)
Drupal\Core\Form\FormBuilder->processForm('media_image_delete_form', Array, Object) (Line: 318)
Drupal\Core\Form\FormBuilder->buildForm('media_image_delete_form', 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: 582)
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}() (Line: 151)
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: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 666)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)