Upgrading to Drupal 9.5.9 (from 9.4.8) produces exception: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() when trying to save a newly created node.

Created on 16 June 2023, over 1 year ago
Updated 14 September 2024, 3 months ago

Problem/Motivation

After upgrading from 9.4.8 to 9.5.9, users could no longer create /save a new node of a specific content type. We get the WSOD and two exception messages:

Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of /mnt/drupal_sync/www_drupal95/core/lib/Drupal/Core/Entity/EntityBase.php).

Drupal\Core\Entity\EntityStorageException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /mnt/drupal_sync/www_drupal95/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

The content type has many fields, many of which are entity reference nodes. The error message does not provide much to go on when troubleshooting.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: cannot reproduce

Version

11.0 🔥

Component
Base 

Last updated about 16 hours ago

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @cdhowell64
  • Status changed to Postponed: needs info over 1 year ago
  • Have all schema updates been executed on the affected site?

    Are all contributed modules at the latest versions?

    Can you generate the stack trace for the exception?

  • Status changed to Closed: cannot reproduce 3 months ago
  • 🇦🇺Australia pameeela

    No additional info provided so I'm closing this, if anyone is able to reproduce it please update the issue summary with steps.

  • 🇮🇪Ireland rosscullen

    Have similar issue:

    Was using layout builder for one of my content types:
    admin/structure/types/manage/example/display/default/layout
    I was manually adding new fields to include and now it won't let me back in.

    Getting error in my log messages:
    "Drupal\Core\Entity\EntityMalformedException: The "node" entity cannot have a URI as it does not have an ID in Drupal\Core\Entity\EntityBase->toUrl() (line 161 of /home/example.com/public_html/example.com/core/lib/Drupal/Core/Entity/EntityBase.php).

    Using Drupal 11.0.2

Production build 0.71.5 2024