Cannot add a new Radioactivity field if content exists

Created on 15 June 2024, 5 months ago
Updated 18 September 2024, 2 months ago

Problem/Motivation

Adding the Radioactivity module to an existing site fails. The site WSODs while trying to add a Radioactivity field to a content type that already has content in it.

Steps to reproduce

1. Create a fresh Drupal 10 site
2. Add a Basic Page node
3. Add a new Radioactivity reference called "rads" to the Article content type, no issues.
3. Add a new Radioactivity reference called "popularity" to Basic Pages
4. Boom. The error is:

2024-06-15T14:09:06.777139-04:00 oss drupal: https://oss.vm|1718474946|php|192.168.122.1|https://oss.vm/admin/structure/types/manage/page/add-field/node/field_popularity?destinations%5B0%5D%5Broute_name%5D=entity.node.field_ui_fields&destinations%5B0%5D%5Broute_parameters%5D%5Bentity_type%5D=node&destinations%5B0%5D%5Broute_parameters%5D%5Bfield_name%5D=field_popularity&destinations%5B0%5D%5Broute_parameters%5D%5Bnode_type%5D=page&destinations%5B1%5D=%2Fadmin%2Fstructure%2Ftypes%2Fmanage%2Fpage%2Ffields%2Fadd-field|https://oss.vm/admin/structure/types/manage/page/fields/add-field|1||Drupal\Core\Entity\Query\QueryException: 'field_popularity' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of /home/vmadmin/oss.vm/web/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

Proposed resolution

The call to RadioactivityReferenceItem::fieldDataIsMissing() looks for a field that doesn't yet exist and triggers an uncatchable exception. Remove addReferenceFieldWarning() and generate new entity references either via batch API after the fact or as nodes are energized for the first time.

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States John Franklin

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024