Hi,

I get a blank page in admin/content. No error. Everything else is working fine in the Admin Menu including Add content and Comments under the Content Menu.

Drupal 8.4.2 (problem was the sma with 8.4.1)
Modules
Admin Toolbar 8.x-1.21
Calendar 8.x-1.x-dev (2017-Oct-04)
CAPTCHA 8.x-1.0-beta1
Content Access 8.x-1.0-alpha1
Field tools 8.x-1.0-alpha4
Menu block 8.x-1.4
Menu Multilingual 8.x-1.x-dev (2017-Nov-27)
Module Filter 8.x-3.1
Protected Pages 8.x-1.0
reCAPTCHA 8.x-2.2
Rules 8.x-3.0-alpha3
Simple Google Maps 8.x-1.4
Typed Data API enhancements 8.x-1.0-alpha1
Views Templates 8.x-1.0-alpha1
Webform 8.x-5.0-beta24

Issue fork drupal-2928108

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Gib... created an issue. See original summary.

cilefen’s picture

It this a blank page, as in pure white? If so, please read https://www.drupal.org/node/158043 and report back the error found. Was this not a problem on Drupal 8.3.x?

Gib...’s picture

Title: Blank page in admin/content » Blank page (WSOD) in admin/content

Hi,

Thanks. I did not knew how to get error message. Here is the one I get loading ad,in/content:

Fatal error: Call to a member function isTranslatable() on null in /home/.../public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php on line 1183

cilefen’s picture

cilefen’s picture

Title: Blank page (WSOD) in admin/content » Call to a member function isTranslatable() on null in SqlContentEntityStorage
cilefen’s picture

Component: base system » entity system
oknate’s picture

StatusFileSize
new1.1 KB

I found this happening after Drupal 8.4.2 as well, but not previously.

Here's a patch.

I also think I have found a work-around. You can find the field that doesn't have a definition by adding this code temporarily right above line 1183:

if (empty($definitions[$bundle][$field_name])) {
  dump([$bundle, $field_name]); die();
}

Then if you resave that field, the problem seems to go away. In my case, it was a "Text (plain)" field on a paragraph. Of course, I still think the patch is valid. Although $definitions[$bundle][$field_name] should never be empty, it clearly is for some Drupal sites and it would be better for the site not to give the WSOD if it's empty.

oknate’s picture

Status: Active » Needs review
Gib...’s picture

Thank you very much,

The patch solved my problem indeed.

Bye

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

oknate’s picture

StatusFileSize
new1.19 KB

Rerolling patch for 8.5.0-rc1, also moving some of the logic out of the if statement so that it's more readable.

hchonov’s picture

Those changes should not be necessary. When you look at the method implementation \Drupal\Core\Entity\Sql\SqlContentEntityStorage::loadFromDedicatedTables() you'll see that we retrieve the entries from the field table and read out the bundle from there. If $definitions[$bundle][$field_name] is not set then there is one possible error I could think of - for some reason you have an entry in the field table pointing to a bundle on which the field doesn't exist. How this happened is unclear to me.

oknate’s picture

Thanks for the feedback. Because the code didn't account for it before, it makes sense that the change shouldn't be necessary. Anyway, in my situation, something went off the rails, and it was necessary, so I created a patch. It looks like no one else has had the problem. I guess you can mark it as Closed (won't fix). If someone else encounters the issue and has more detail as to why it's happening, perhaps a better patch will come along.

hchonov’s picture

Status: Needs review » Closed (cannot reproduce)

I would suggest that you investigate the row being retrieved. You should not be needing the patch either. Closing the issue for now as without further information there is not much we can do. Feel free to re-open it if you want to dig in.

robotjox’s picture

I'm responding to this closed issue because I had this exact problem too, and the patch brought my unresponsive back to life, so thanks for that. So I'm thinking this might be relevant after all?
My site was upgraded from Drupal 6 to 8, so maybe that plays into it?

hchonov’s picture

Status: Closed (cannot reproduce) » Postponed (maintainer needs more info)

We then need more information how this could be reproduced.

nebel54’s picture

We are facing the same issue, i found some first clues:

We are migrating a site from D6 to D8 - the problem occurs after migrating translated versions of nodes. After digging a bit more in i found out, that migration of translations broke the node bundle in the node table.

I will investigate further, but at the moment i can say that the problem occurs if the type column in the node table differs from the bundle column in a field table. Example:

mysql> SELECT * FROM node where nid=39634;
+-------+-------+-----------------+--------------------------------------+----------+
| nid   | vid   | type            | uuid                                 | langcode |
+-------+-------+-----------------+--------------------------------------+----------+
| 39634 | 11228 | document_simple | 96f9e656-8476-4164-a204-169121be4941 | en       |
+-------+-------+-----------------+--------------------------------------+----------+
1 row in set (0.00 sec)

mysql> SELECT bundle FROM node__body where entity_id=39634;
+-------------+
| bundle      |
+-------------+
| publication |
| publication |
+-------------+
2 rows in set (0.00 sec)

@robotjox: Did you deal with translated content too? Can you execute this sql snippet in your drupal db to see if there is a mismatch too? It should return an empty result if everything is ok, otherwise it will return missmatched nodes.

SELECT * FROM node n LEFT JOIN node__body b ON (n.nid=b.entity_id) WHERE n.type!=b.bundle;
akalam’s picture

Also having this issue. This patch fixed for me

nebel54’s picture

@akalam: Can you check if you get any results when you execute this sql query?

SELECT * FROM node n LEFT JOIN node__body b ON (n.nid=b.entity_id) WHERE n.type!=b.bundle;

Did you migrate contents from an old D6/D7 installation?

crash_springfield’s picture

Having this issue in a D7->D8 migration and the patch fixed it.

nebel54’s picture

@crash_springfield: Can you please executing my beforementioned statemenet in your database?

Thank you for mentioning that you migrated from 7 to 8. I have the theory that when using a node migration where the
destination.default_bundle is missing the bundle type is not saved correctly in D8. For me it looks like the default_bundle option did not exist in older migrate versions. So this may effect many migrations that have been started with older migrate months ago and are going to be finished now.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

daveiano’s picture

I have the same problem after importing content from D7 to D8.

I could not access the content Overview Page in D8, the patch solved this. But my main problem is that after I imported content from D7 to D8, I also lost a lot of content, which was previously created and has nothing to do with Import (the node type is not included in the import).

So imported content is fine, but unrelated nodes were removed during the import.

@Nebel54 What do you mean with: destination.default_bundle

All my imports have something like this:

process:
  type:
    plugin: default_value
    default_value: tattoo_appointment
nebel54’s picture

@daveiano: You need to set the destination bundle as destination parameter, e.g.:

destination:
  plugin: entity:node
  default_bundle: tattoo_appointment

It helped in my case, but after studying #2700581, I'm not sure anymore if this was the fix to my problems. But you can give it a try. See also the Documentation which does not use the type parameter in the process section anymore.

daveiano’s picture

@Nebel54: Ah ok I got you.

Ok I also looked into 2700581 but the issue is 2 years old? Dont know if the info from #40 is still relevant?

What is very strange: I did a second test:

First, I reimported a DB from before the first migration, so my lost content is back, the patch from #11 is still applied. Then I started a new import without changing anything in my migration sources or configs. Result: It works, no content was removed or changed...

I don't know if the issue was solved by the patch or if this is random behavior, but I will do a 3rd test to be sure without the patch.

daveiano’s picture

I reimported all content without the patch applied - the same result, everything works.

No translation error and no missing content. But I suppose when doing the production import everything will crash...

daveiano’s picture

I found out that my nodes were not disappeared during the import.

@Nebel54: Your SQL statement returned the nodes is was looking for.

They were attached to some of the imported content as translation, but I could not reproduce this again. Possibly some misconfiguration of the time of the import?

nebel54’s picture

@daveiano: Thanks for your feedback! The problem disappeared for me when I set the target bundle in the process section and run the migration again. Did you also update your migration configuration, or did you leave the assignment in the process section?

daveiano’s picture

@Nebel54: I changed it

from

process:
  type:
    plugin: default_value
    default_value: inquiry

to

destination:
  plugin: entity:node
  default_bundle: inquiry

Did I misunderstand something?

nebel54’s picture

No, everything is fine :) It just was not clear to me if the problem disappeared in your case because of this change, or just by accident…

daveiano’s picture

I think I found the problem for my special case:

We were importing Content from D7 to D8 in two steps: First, some content (let's say content type A and B), then a test phase and later a second import to import content type C and D. Between the imports other content got created (E).

I had the following in my migrations:

process:
  nid: nid

So I had the same nids in the old D7 site and the new D8 site. What I overlooked was that through the creation of Content E, some nids got occupied by new content. When then the second import was started, the nids were already taken and then overwritten with the new content, hence the mismatching.

I removed the nid: nid part and everything works fine.

abu-zakham’s picture

StatusFileSize
new1.19 KB

I've rerolled patch #11 for branch 8.5.x.

tostinni’s picture

StatusFileSize
new1.19 KB

Thanks for the patch, it helped avoid this error on my side.
Digging a little more, I haven't made any migration, but it looks like the field that Google Analytics Counter module adds during its installation is the culprit for me.

I updated the patch for 8.6.x branch

kovtunos’s picture

Thanks for the patch. It helped a lot. I got this error after uninstalling metatag submodule.

bramdriesen’s picture

This also fixed the issue for me, also faced the same error in another module.

papagrande’s picture

Status: Postponed (maintainer needs more info) » Needs review

The patch in #33 worked for me. In my case, a D7 to D8 migration was working until I decided to change the machine name of the node bundle in D8. With the patch, the error went away.

trebormc’s picture

The patch in #33 worked for me.

DocRPP’s picture

The patch in #33 worked for me as well.

daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Great to hear that the patch fixes the problem. Can you explain how you tested the patch. We can use it to create an automated test. In that way we can be sure that this fix does not accidentally unfixed.

revathi.b’s picture

In my case,

I have created a node and translated that node to some language(example: created node on "de" and translated to "en"). In my admin content translation settings enabled all fields and entities including paragraph entities. If I forgot any paragraph entities to enable in config translation and used that field in node, it throws isTranslatable() on null error.
Above patch is working fine in my case.

Thanks,
Revathi.B

bbombachini’s picture

StatusFileSize
new1.22 KB

The patch wasn't applying anymore, re run to 8.7.5.

dan_metille’s picture

#41 patch could not apply on 8.7.7 (with composer)

paul rowell’s picture

StatusFileSize
new1.2 KB

Attaching patch for 8.7.10

Note this occurred for me as an translated node was migrated to an existing untranslated node - not sure which field caused the error but patch corrected it.

daffie’s picture

Status: Needs work » Needs review

Let the testbot run!

daffie’s picture

Status: Needs review » Needs work

Back to needs work

andrimont’s picture

Thanks to @Paul Rowell and all others contributing to this patch
The patch #43 works on D8.7.7 and D8.7.10 to give access to the content page ;-)
Still how can I locate the culprit node or paragraph that has translation issue ?

daffie’s picture

Issue tags: +Needs reroll
akashkumar07’s picture

Status: Needs work » Needs review
StatusFileSize
new1.06 KB

Added reroll of #43 in D8.6.x-dev.

daffie’s picture

Status: Needs review » Needs work
akashkumar07’s picture

Status: Needs work » Needs review
StatusFileSize
new1.26 KB

Added reroll of #43 in D8.9.x-dev.

daffie’s picture

Version: 8.6.x-dev » 8.9.x-dev
michelhensen’s picture

I have the same problem.
It started with 8.7, and was temporarily fixable by comment out this part of the file SqlContentEntityStorage.php lines 1281-1299.
When commented out, i was able to delete the last node, restore the code and remake the node.
It happens randomly. Sometimes 5 node's worked fine, and sometimes every node will break te site.

After update with drush ran into more problems. Restored from backup and updated manually to drupal 8.8. Same problem.

I run drupal 8.8 on lamp ubuntu vmware, the site is not migrated, but from scratch build. I did try to migrate my production site, but no luck. So i started from scratch. After 3 times run in errors i am not able to recover from, now this. I am manually transfer a 4500 page's site, and after three times starting all over it's getting annoying.

I am desperate. I walk from one error to the next error.

After update.php this is the error;
system module

Update #8804

Failed: Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '19' for key 'PRIMARY': INSERT INTO {path_alias} (id, revision_id, uuid, path, alias, langcode, status) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, - db_insert_placeholder_1399 ...... 429 [:db_insert_placeholder_1387] => 429 [:db_insert_placeholder_1388] => eff345de-5c4e-406c-abd9-eeae122568e9 [:db_insert_placeholder_1389] => /node/270 [:db_insert_placeholder_1390] => /canal_de_givors [:db_insert_placeholder_1391] => nl [:db_insert_placeholder_1392] => 1 [:db_insert_placeholder_1393] => 430 [:db_insert_placeholder_1394] => 430 [:db_insert_placeholder_1395] => c73781b7-3f94-4291-a460-9f308eb4613d [:db_insert_placeholder_1396] => /node/271 [:db_insert_placeholder_1397] => /canal_de_ille_et_rance [:db_insert_placeholder_1398] => nl [:db_insert_placeholder_1399] => 1 ) in Drupal\Core\Database\Connection->handleQueryException() (line 692 of /var/www/8binnenvaart/core/lib/Drupal/Core/Database/Connection.php).

daffie’s picture

@michelhensen: Sorry to hear of your troubles. Could you create a new issue for your problem and add the tag "8.8.0 update" to it. It should now be listed in: https://www.drupal.org/project/issues/search?issue_tags=8.8.0%20update. Unfortunately you are not alone with problems involving the updating to Drupal 8.8.0.

michelhensen’s picture

I will try. Thanks.

michelhensen’s picture

I will try. Thanks.

Percy101’s picture

Issue tags: -Needs reroll

Patch applied cleanly

andrimont’s picture

Hello, I was in huge trouble, losing precious days trying to locate the trouble.
This post help me on Drupal 8.8.2
The pach #50 for 8.9 works !
I did hesitate to apply as running D8.8 but it save not my day but my work that had been put in a nasty stand-by.
Thanks to all and @AkashkumarOSL.
UPDATE : With Drupal 8.8.4, the patch is still highly needed.

sinasalek’s picture

Applied the patch against 8.9beta2 and it fixed my problem. txx

daffie’s picture

Status: Needs review » Needs work

This issue still needs tests.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

marco-s’s picture

We had the same error a few times on a website (Drupal 9.0.6). We assume the cause in connection with a cache clear when there is a too much traffic.

Why the $definitions is empty in that case, we could not evaluate yet.
But I am not sure how solid the patch #50 is. Because if $definitions is not present, we skip the complete language, which is then stored in the cache with the entity. This means, until the next cache clear we have an inconsistent state of the translation in the entity cache.

marco-s’s picture

We are currently trying to determine the root cause.
If there is a missing definition we also remove the entity, to prevent it from being stored in the entity storage cache.

SqlContentEntityStorage::loadFromDedicatedTables()

// ...

if ((!isset($definitions[$bundle][$field_name]) || !$definitions[$bundle][$field_name] instanceof FieldConfigInterface)) {
  if (isset($values[$value_key])) {
    unset($values[$value_key]);
    \Drupal::logger('core')->warning('WRITE SOME LOGS...');
  }

  // Skip the language handling below as this definition is empty.
  continue;
}

if ($langcode == LanguageInterface::LANGCODE_DEFAULT || $definitions[$bundle][$field_name]->isTranslatable()) {
	// ...
joseph.olstad’s picture

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

hrajkarnikar’s picture

Patch #50 worked for me!!

bamlhes’s picture

I just apply patch #50 and work well for me also solve this issue
Thank you @AkashKumar07

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

Confirming #50 fixes the issue for us, which we ran into in a Drupal 6 > 9 Migration. As there are several duplicates of this issue, coming from different use-cases (like e.g. #3195297: using convert_bundles module can expose db api bug or #3090206: Call to a member function isTranslatable() on null in NodeSearch, ...) we should decide how to proceed here and with which one. #3195297 has a much cleaner issue template and a similar patch. On the other hand, this has a lot more feedback.

Anyway, this indeed seems like a core bug which is quite common to run into, so it should be targeted.

anchal_gupta’s picture

StatusFileSize
new1.26 KB

Rerolled patch against 9.5x.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

antiorario’s picture

StatusFileSize
new1.24 KB

I was having issues applying the patch via composer, and I figured the issue was with the file path starting with core/. Rerolling to fix that.

smustgrave’s picture

kriboogh’s picture

#70 applies to 9.5.3 (#71 not)

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

qpro’s picture

Tested #72 in Drupal 10.2.6 and 8.1.27,
it works but I had to set patchLevel to -p1 in composer.json , usually is -p2 for core patches.
It could be better to change lines, .../core/lib/... instead .../lib/...

(explanation patch level here: https://architecture.lullabot.com/adr/20220119-composer-patches/)

kriboogh’s picture

StatusFileSize
new1.32 KB

Create a MR based on #72.
Added patch of MR for use in composer.
Applies to 11.x and 10.3.x.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.