Problem/Motivation
When trying to delete redirects for a language (here on core 10.5.8 with redirect 8.x-1.12)
the batch returns this error :
Drupal\Core\Entity\Query\QueryException: 'langcode' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
HTTP Result Code: 500
Debugging information follows.
Path: /batch?id=82&op=do_nojs&op=do
StatusText: error
ResponseText: The website encountered an unexpected error. Try again later.Drupal\Core\Entity\Query\QueryException: 'langcode' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php). Drupal\Core\Entity\Query\Sql\Tables->addField('langcode', 'INNER', NULL) (Line: 58)
Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 193)
Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 82)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 186)
Drupal\delete_entity_translations\Form\DeleteEntityTranslationsForm->processItems('nl', 'redirect', Array) (Line: 297)
_batch_process() (Line: 139)
_batch_do() (Line: 95)
_batch_page(Object) (Line: 52)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
With multiple languages and redirect module installed attempt to delete redirects in a language
Proposed resolution
We might probably handle the exception and report that one specific entity type failed to be deleted. instead of blocking the rest of the batch.
Comments
Comment #4
nickolajThis patch fixes the 'langcode' not found error by filtering entity types in the selection list to only include those that have a langcode key, and adds try/catch exception handling in processItems() so that unsupported entity types are gracefully skipped with a warning message instead of crashing the batch.
Comment #5
fromme commentedHello @nickolaj!
Thank you for your attention and effort. I left a few comments in the MR that are worth considering. Please look into them.
Comment #6
fromme commentedFixed, comes with 1.0.5 release