Site crush when creating new fields

Created on 19 September 2024, 2 months ago
Updated 20 September 2024, 2 months ago

Problem/Motivation

When adding new field to Tasks, site will crush with:
AssertionError: "Burndown" must be defined in MODULE_NAME.field_type_categories.yml in assert() (line 183 of /var/www/html/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php).

After adding that file, there will be also a markup translate error:
TypeError: Cannot access offset of type Drupal\Core\StringTranslation\TranslatableMarkup in isset or empty in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 61 of /var/www/html/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Steps to reproduce

Go to:
/admin/structure/burndown_task_type/task/edit/fields/add-field

Proposed resolution

1. Add burndown.field_type_categories.yml file
2. Remove all instance of @Translation("..."), in plugin folder

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇷Argentina leofishman

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

Comments & Activities

  • Issue created by @leofishman
  • 🇨🇦Canada jeremylichtman

    Hi @leofishman,

    I'm looking into the yml definition issue.

    The @Translation markup is needed for D8/9/10 blocks. I have been hunting for good documentation on how the block plugin header section is supposed to work in D11, but there's not much out there right now. I'll continue looking, but if you have working examples please let me know!

  • 🇦🇷Argentina leofishman

    This is also very new to me, I am working on Drupal 11 now, but I assume that this issue may arise in every plugin, maybe we should wait for Drupal to resolve it?

  • 🇨🇦Canada jeremylichtman

    I think it might even be a core bug. Not sure.

    I'm setting up a dev env with D11 so I can look at the other issue.

  • 🇨🇦Canada jeremylichtman

    @leofishman I've pushed a commit on the dev branch.

    I didn't remove *all* "@Translate" instances, just from the plugin categories. I think that is deprecated now.

    Do you want to try that out?

    Still looking into the yml issue. Having issues with my local.

  • 🇨🇦Canada jeremylichtman

    Hi @leofishman,

    Tag 1.0.41 seems to fix the issues you were seeing.

    You may need to completely uninstall burndown and reinstall it.

  • 🇦🇷Argentina leofishman

    same error:
    The website encountered an unexpected error. Try again later.

    AssertionError: "Burndown" must be defined in MODULE_NAME.field_type_categories.yml in assert() (line 183 of core/lib/Drupal/Core/Field/FieldTypePluginManager.php).
    Drupal\Core\Field\FieldTypePluginManager->getGroupedDefinitions() (Line: 131)

    Adding the file burndown.field_type_categories.yml fix it and don't give the translation markup error anymore.

  • 🇨🇦Canada jeremylichtman

    I wasn't able to duplicate the issue, but have added the yml to config, and have created tag 1.0.42.

  • 🇧🇪Belgium matthieu_collet

    hello

    we have this issue but saw that burndown.field_type_categories.yml was already there, so we don't understand ?

  • 🇨🇦Canada jeremylichtman

    Hi @matthieu_collet, which of the two errors in the issue description did you see?

    What version of Drupal are you running, and which tag of burndown?

  • 🇧🇪Belgium matthieu_collet

    hi Jeremy,

    Drupal core 10.3.6 , and we have the error with all last versions
    specific error is :

    AssertionError: "Burndown" must be defined in MODULE_NAME.field_type_categories.yml in assert() (line 195 of /home/clients/d87d768f62381a25028b1764b41ce1a4/sites/burndowndansdbox/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php).
    
  • 🇨🇦Canada jeremylichtman

    The assert is coming from https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Field%21F... in the function getGroupedDefinitions.

    If you have the most recent tag of Burndown, that shouldn't be triggering.

    Can you check that the yml actually exists in your file structure?

    Cache clear help?

    I'm fairly sure that the contents of the yml are okay, unless there's an issue of capitalization.

  • 🇧🇪Belgium davidiio

    Hi Jeremy, I continue for Matthieu.

    We have tried 1.0.43, 42, 41 and also 1.0.x-dev and always have the issue.

    The file burndown.field_type_categories.yml is present in burndown/config/install and also in our drupal /config/sync folder:

    Burndown:
      label: 'Burndown Fields'

    Cache clear did not help.

    Do you see anything wrong here?

  • 🇨🇦Canada jeremylichtman

    Only thing I can think of, if you're able to do so, is to put a breakpoint on that assert statement and see what Drupal is actually expecting.

    I haven't been able to duplicate this lately, so no clue.

  • 🇨🇦Canada jeremylichtman

    Just tried a clean install on SimplyTest.me and have no problem creating fields on tasks.

    Couple more questions:

    * Was this a new task type? (I did test this though)
    * What type of field was it? (I tried a few different types)

  • 🇧🇪Belgium davidiio

    I have tried desabling and reenabling the module.
    When module is enable we can't create any field on any content type, juste tried on Article, when clicking on "create new field" we get the error.
    I will investigate more

  • 🇨🇦Canada jeremylichtman

    This sounds like a conflict with another module.

  • 🇧🇪Belgium davidiio

    I really don't get it. I also tried it on simplytest.me and it worked on standard drupal 10.3.6 and burndown 1.0.43.
    But when trying a new standard drupal 10.3.6 with burndown 1.0.43 on my server I have the error.
    I don't know what's going on but thanks for your help!

Production build 0.71.5 2024