Update existing 'node' entity while changing the ID is not supported

Created on 23 May 2023, over 1 year ago

Problem/Motivation

Using release 8.x-3.0 with Drupal 9.5.9 I get the following error message:
Drupal\Core\Entity\EntityStorageException: Update existing 'node' entity while changing the ID is not supported. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /home/james/xequals/smartbuild/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Note that I have group 8.x-1.5 installed and the node being created is group content. This might be significant.

Steps to reproduce

Create a node of type with an auto_entitylabel defined using the standard group plugin creation process.

Proposed resolution

The patch listed here 🌱 Support [node:nid] token | specially for prefilled option Fixed on closed issue 🌱 Support [node:nid] token | specially for prefilled option Fixed solves this problem for me.

It would appear that the logic present in the original patch associated with issue #2920695 contains some errors which the later patch corrects.

Note that updating/saving an entity during a hook_insert or hook_update is not a supported operation, as it can lead to infinite loops.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇳🇿New Zealand jlscott

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

Comments & Activities

Production build 0.71.5 2024