TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition()

Created on 10 April 2025, 3 months ago

Problem/Motivation

I'm not sure if this should be reported as part of Drupal Core or if this should be reported as an issue with the Constant Contact Module v4.2.1.

This issue only occurs once the Constant Contact Module v4.2.1 is enabled in Drupal but the error is occurring elsewhere in Drupal.

In the admin, if I go to Structure->Content Types->Article (it does occur with other content types as well) -> Manage Fields.

The Manage fields screen appears.

When I click on the button to Create a new field, I get the following fatal error:

The website encountered an unexpected error. Try again later.

TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 45 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition() (Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 136)
Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (Line: 80)
Drupal\field_ui\Form\FieldStorageAddForm->buildForm()
call_user_func_array() (Line: 528)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Reusing an existing field works.

I am using PHP v8.3.17 with Drupal 11.1.6 on Apache and is managed via Composer.

The work around to add a field is to remove the Constant Contact Module v4.2.1. If this should be submitted as an issue with that module, please let me know and I will do so.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.1 πŸ”₯

Component

plugin system

Created by

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

Comments & Activities

  • Issue created by @wschwab
  • Thank you for including a stack trace. Please add the verified steps to reproduce the bug on a newly-installed Drupal site.

  • Steps to Reproduce

    1. Install Drupal 11.1.6 using GoDaddy's Cpanel process
    2. Updated settings.php to include displaying verbose error - $config['system.logging']['error_level'] = 'verbose';
    3. Log in as admin
    4. Go to Structure->Content types->Article->Manage fields
    5. Click on Create a new field
    6. Add field screen appears. Select Plain text and click on Continue.
    7. When prompted for a Label, entered: Test. Selected Text (plain) and then clicked on Continue.
    8. On the screen Test settings for Article, clicked the button Save settings
    9. Field is created, which is what is expected
    10. From the shell prompt, installed the Constant Contact module using the command: "composer require 'drupal/ik_constant_contact:^4.2'"

    The following are the results of the command:
    ./composer.json has been updated
    Running composer update drupal/ik_constant_contact
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 1 install, 0 updates, 0 removals
    - Locking drupal/ik_constant_contact (4.2.1)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
    - Installing drupal/ik_constant_contact (4.2.1): Extracting archive
    Generating autoload files
    Hardening vendor directory with .htaccess file.
    40 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    Scaffolding files for drupal/core:
    - Copy [web-root]/.htaccess from assets/scaffold/files/htaccess
    Cleaning installed packages.
    No security vulnerability advisories found.

    • Navigated to Extend and checked the box for the Constant Contact Module before clicking Install
    • Go to Structure->Content types->Article->Manage fields
    • Click on Create a new field
    • Fatal error appears

    The following is the stack trace:
    The website encountered an unexpected error. Try again later.

    TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 45 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
    Drupal\Core\Plugin\DefaultPluginManager->getDefinition() (Line: 16)
    Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 76)
    Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 136)
    Drupal\field_ui\Form\FieldStorageAddForm->processFieldDefinitions() (Line: 80)
    Drupal\field_ui\Form\FieldStorageAddForm->buildForm()
    call_user_func_array() (Line: 528)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 279)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    • composer update was run on this install and the following was the results

    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 0 installs, 1 update, 0 removals
    - Upgrading doctrine/deprecations (1.1.4 => 1.1.5)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 0 installs, 1 update, 0 removals
    - Upgrading doctrine/deprecations (1.1.4 => 1.1.5): Extracting archive
    Generating autoload files
    Hardening vendor directory with .htaccess file.
    40 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    Cleaning installed packages.
    No security vulnerability advisories found.

  • @wschwab Usually you would put that info in the issue summary under the "Steps to Reproduce" heading, so future readers can be oriented quickly. As this issue seems to require the contstant contact module to trigger the bug, I think this issue belongs there.

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    Thanks all. I'll be looking into this as soon as I can. There were some annotation changes in Drupal 11 so it is likely something else has changed that was missed.

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley

    Please check out 4.2.2 β†’ . It seems I never bundled one of the changes from #3513890 πŸ› AssertionError: "Constant Contact" must be defined in .... Active and likely is causing your issue. Let me know. Sorry about that.

  • 4.2.2 appears to have fixed the issue. Thank you for your help!

  • πŸ‡ΊπŸ‡ΈUnited States rosemarystanley
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024