Exception: Invalid field category for field type: "entity_reference_hierarchy", category must be the ID of a defined field category, got "Reference". in Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (line 136 of /app/docroot/core/mod

Created on 16 January 2025, 9 months ago

Problem/Motivation

After installing module (3.3.11) on Drupal 11.0.10, and try to "Create new field" on any content type I got error
"Exception: Invalid field category for field type: "entity_reference_hierarchy", category must be the ID of a defined field category, got "Reference". in Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (line 136 of /app/docroot/core/modules/field_ui/src/Form/FieldStorageAddForm.php)."

Steps to reproduce

1. Install module
2. Go to "Manage fields" (any content type)
3. Click on "Create new field" you got WOS

NOTE: Default message in watchdog was
"TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 45 of /app/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php)."

But after applying patch from https://www.drupal.org/project/drupal/issues/3475505 πŸ› Changes in site building process can run into Cannot access offset of type StringTranslation\TranslatableMarkup on field creation path Active (https://git.drupalcode.org/project/drupal/-/merge_requests/10556/diffs.p...)
The error is "Exception: Invalid field category for field type: "entity_reference_hierarchy", category must be the ID of a defined field category, got "Reference". in Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (line 136 of /app/docroot/core/modules/field_ui/src/Form/FieldStorageAddForm.php)."

πŸ› Bug report
Status

Active

Version

3.0

Component

Code (module)

Created by

πŸ‡·πŸ‡ΈSerbia rakun

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

Comments & Activities

  • Issue created by @rakun
  • πŸ‡ΈπŸ‡°Slovakia tomas.teicher

    I think the problem is already fixed in current default 3.x branch.

    See the definition in the source code of the mentioned field type. Category is set there as ID, not as translatable string.

  • Status changed to Closed: duplicate 3 days ago
Production build 0.71.5 2024