when visiting content page following error occurs,

TypeError: Argument 1 passed to Drupal\views\Plugin\views\field\EntityOperations::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Applications/MAMP/htdocs/drupal-8.9/core/modules/views/src/Plugin/views/field/EntityOperations.php on line 142 in Drupal\views\Plugin\views\field\EntityOperations->getEntityTranslation() (line 69 of /Applications/MAMP/htdocs/drupal-8.9/core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php)

Comments

Hardik_Patel_12 created an issue. See original summary.

bakidok’s picture

Same here, visiting "People" page, version 8.8.1.

TypeError: Argument 1 passed to Drupal\views\Plugin\views\field\EntityOperations::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in C:\wamp\www\gestor\core\modules\views\src\Plugin\views\field\EntityOperations.php on line 142 in Drupal\views\Plugin\views\field\EntityOperations->getEntityTranslation() (line 69 of core\modules\views\src\Entity\Render\EntityTranslationRenderTrait.php).

masher’s picture

Same here +1

Reverting to 8.7.11 solved the error

xld’s picture

Same issue on 8.7.11 on a rest export for comments. Exporting the entity.

lendude’s picture

Status: Needs work » Closed (duplicate)
Issue tags: +Needs steps to reproduce

We need steps to reproduce this, since this obviously doesn't happen with just a clean core install.

But probably a duplicate of #3007424: Multiple usages of FieldPluginBase::getEntity do not check for NULL, leading to WSOD so closing as that for now, if you have specific steps to reproduce this that isn't covered by that issue, feel free to reopen it

meladawy’s picture

Same issue here. I managed to reproduce the issue with the following configuration
1. Install profile module https://www.drupal.org/project/profile
2. Create views that list users and add relation to their profile (optional relation)
3. Add field "Profile: Operations links" to the views
4. The error show if any of the users doesn't have profile associated with his account
5. The error doesn't show if all the users has profile associated with their account

meladawy’s picture

StatusFileSize
new755 bytes

Adding validation around values would simply fix it. Not sure if it's the best practice to handle empty output.

meladawy’s picture

StatusFileSize
new895 bytes

In some cases the `$values` variable is not empty but the retrieved entities are empty. This patch to handle this case.

dmgig’s picture

I get a similar error, only in the BulkForm class.

TypeError: Argument 1 passed to Drupal\views\Plugin\views\field\BulkForm::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/docroot/core/modules/views/src/Plugin/views/field/BulkForm.php on line 311 in Drupal\views\Plugin\views\field\BulkForm->getEntityTranslation() (line 69 of core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).

PeterStubRaindrop’s picture

#8 works - if u disable "Node operations bulk form" in views. If not - u get a new error and content is not listed under /admin/content:

TypeError: Argument 1 passed to Drupal\views\Plugin\views\field\BulkForm::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Applications/MAMP/htdocs/dcu/web/core/modules/views/src/Plugin/views/field/BulkForm.php on line 311 in Drupal\views\Plugin\views\field\BulkForm->getEntityTranslation() (line 69 of /Applications/MAMP/htdocs/dcu/web/core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php)

EDIT: FORGET THIS PATCH...!!!!
Drupal 8.9.6: Go here: https://www.drupal.org/project/drupal/issues/3007424
And apply #108...

marcelovani’s picture

I can reproduce this error with these steps:

1. Install Drupal with `drush si -y standard`

2. Create a behat test with

@api @error
Feature: Team
  In order to reproduce the bug
  as a user
  I want to login as admin

  Scenario: Test user error
    Given I am logged in as a user with the "Administrator" role

3. Run the test with `/behat --tags=@error`

4. Navigate to /admin/people and refresh the page few times while the test is running

I get this

The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\views\Plugin\views\field\EntityOperations::getEntityTranslation() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/web/core/modules/views/src/Plugin/views/field/EntityOperations.php on line 142 in Drupal\views\Plugin\views\field\EntityOperations->getEntityTranslation() (line 69 of core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php).

To fix it I need to run `drush cr`

I don't know if my conditions to reproduce are the same as other people, but the error is similar. I think its a racing condition. I will have to dig to find if its caused by Behat when clearing the generated user, or its a Drupal core issue...

The patch on this issue doesn't fix the problem, I will have a go with the other patch in the linked issue.

marcelovani’s picture

After digging a bit, I found that the issue is caused by cache tags in the admin/people view.
I disabled caching on this view and the problem was gone. Of course this is not the solution for the problem.

I tested the patch on #3007424 and that solved the problem.

abedajam’s picture

StatusFileSize
new1.95 KB

This issue is caused by Views Bulk Operation form, which calls for calculateEntityBulkFormKey on null. I'm using VBO 8.3.9 btw

abedajam’s picture

StatusFileSize
new1.63 KB
stephen ollman’s picture

Patch at #14 did the trick. Many thanks!

My issue occurred whilst trying to access the Custom Block Library.

Running 8.9.13. Will this be rolled in a future core release?

vlad.dancer’s picture

@Stephen Ollman

> My issue occurred whilst trying to access the Custom Block Library.

The issue could be caused by broken page's view configuration. In our case the view (views.view.block_content.yml) had no "Reusable = True" filter. That caused to show blocks used by Layout Builder. Showing inline blocks is not designed for Custom Block Library page.

golubovicm’s picture

Confirming that patch from #14 works for me too. Running Drupal 9.3.0.

kartagis’s picture

Tried #14, it applied but with offset. 9.3.5 here.

alanin’s picture

Hello. None of the listed patches help to fix a similar problem for drupal 9.3.14:
TypeError: Drupal\views\Plugin\views\field\BulkForm::getEntityTranslation(): Argument #1 ($entity) must be of type Drupal\Core\Entity\EntityInterface, null given, called in /var/www/html/ drupal/web/core/modules/views/src/Plugin/views/field/BulkForm.php on line 291 in Drupal\views\Plugin\views\field\BulkForm->getEntityTranslation() (line 69 of /var/www/ html/drupal/web/core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php)

krina_t’s picture

Hi,

Were you able to figure out a solution for drupal 9.3.14?
I have the same issue with visiting /admin/content page. Everything was working fine until yesterday, so not sure where the problem started. Assuming that it could be a user error in entering content. But running out of clue on how to find the issue and fix it.

marco.b’s picture

Having the problem with core 9.4.5 at the /admin/content view. As a bad workaround I removed the date-field "node changed" in the views display and now the error doesn't occur anymore.

marco.b’s picture

update: the reason in my case was a corrupt node-database-entry. Since I have removed this one, the view works fine again.

zarpele’s picture

#14 worked for us on Drupal 9.3.16, we still don't know how the entity was corrupted.

The entity was not present in the main table but had some entries on the *_revision, *__field, and *_revision__field tables. So we did an insert into the main table and the view goes back to work again.

SELECT * from my_entity_field_data where nid not in (SELECT nid from my_entity)
To identify the broken entities...

INSERT INTO my_entity (nid, vid, langcode, uuid) values ('THE BROKEN ID', 'LOOKUP FOR THE LAST REVISION', 'en', 'fed4443e-37c4-4226-7aaa-1194d8c65555');
The entity now is accessible, and you can remove, unpublish, etc.

aaronbauman’s picture

Seems like it's related to eva on my install, but not 100% sure yet

bhojwanipankaj05’s picture

StatusFileSize
new52.48 KB

Hi folks,
By applying #14 patch, this empty entity fetal error is being fixed but we can see empty entries will be there in the list. So I have found the solution for it like added UUID field on media views and it fixed the error and removed empty entries which was available only on media_field_data table not on media table. So we don't need to apply the patch we can just add UUID field in filter area of views.