TypeError EntityViewsData::mapFieldDefinition() null given

Created on 9 June 2020, over 4 years ago
Updated 12 December 2023, 12 months ago

I get the following error after upgrading from 8.8 to 8.9.
TypeError: Argument 3 passed to Drupal\views\EntityViewsData::mapFieldDefinition() must implement interface Drupal\Core\Field\FieldDefinitionInterface, null given, called in /var/www/html/web/core/modules/views/src/EntityViewsData.php on line 315 in Drupal\views\EntityViewsData->mapFieldDefinition() (line 412 of core/modules/views/src/EntityViewsData.php).

I made a quick patch to handle the error so that I can keep going until I or someone can take a closer look.
Hope this helps someone.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 2 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States jumoke

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • last update over 1 year ago
    Patch Failed to Apply
  • πŸ‡§πŸ‡ͺBelgium iSoLate

    Rolled patch against 9.5

  • Status changed to Needs work over 1 year ago
  • The Needs Review Queue Bot β†’ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

    This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States fskreuz

    Rerolled against 10.1.x

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    29,444 pass
  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Was previously tagged for tests which still need ot happen.

  • πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

    I'm not sure if bad path mappings should be ignored or exceptions should be thrown.

    Here are two patches for each possibility.

  • πŸ‡ΊπŸ‡ΈUnited States Jon Pugh Newburgh, NY

    I didn't patch against the right repo. new patches attached.

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

    Hi All,

    I still struck with this issue. Could anybody can help with this. I added the patch but is not working please see below:
    ---------------------------
    The website encountered an unexpected error. Please try again later.

    TypeError: Drupal\views\EntityViewsData::mapFieldDefinition(): Argument #3 ($field_definition) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given, called in /home/ide/project/docroot/core/modules/views/src/EntityViewsData.php on line 333 in Drupal\views\EntityViewsData->mapFieldDefinition() (line 435 of core/modules/views/src/EntityViewsData.php).
    Drupal\views\EntityViewsData->getViewsData() (Line: 16)
    Drupal\file\FileViewsData->getViewsData() (Line: 180)
    views_views_data() (Line: 236)
    Drupal\views\ViewsData->Drupal\views\{closure}() (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 244)
    Drupal\views\ViewsData->getData() (Line: 154)
    Drupal\views\ViewsData->get() (Line: 91)
    Drupal\ds\Plugin\Derivative\DsEntityRow->getDerivativeDefinitions() (Line: 101)
    Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives() (Line: 87)
    Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions() (Line: 291)
    Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 181)
    Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 146)
    views_theme() (Line: 455)
    Drupal\Core\Theme\Registry->processExtension() (Line: 348)
    Drupal\Core\Theme\Registry->Drupal\Core\Theme\{closure}() (Line: 388)
    Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 349)
    Drupal\Core\Theme\Registry->build() (Line: 247)
    Drupal\Core\Theme\Registry->get() (Line: 88)
    Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 69)
    Drupal\Core\Utility\ThemeRegistry->__construct() (Line: 267)
    Drupal\Core\Theme\Registry->getRuntime() (Line: 193)
    Drupal\Core\Entity\EntityViewBuilder->getBuildDefaults() (Line: 61)
    Drupal\node\NodeViewBuilder->getBuildDefaults() (Line: 157)
    Drupal\Core\Entity\EntityViewBuilder->viewMultiple() (Line: 123)
    Drupal\Core\Entity\EntityViewBuilder->view() (Line: 134)
    Drupal\Core\Entity\Controller\EntityViewController->view() (Line: 66)
    Drupal\node\Controller\NodeViewController->view()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    ---------------------------------------------------------------------------------------

    Thank you!

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    If/when πŸ› An infinite loop in ViewsJoin could cause denial of service Needs review lands we could probably throw a InvalidViewsDataException here.

    I don't think we should do something like #13 because your site is in a broken state and something like that will leave it broken and just hide it (until the next thing breaks). So the exception direction in #27 sounds like the way to go for me, but would prefer the more specific Exception to be available

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

    @ Lendude, Thank you so much for you look into it. But when I added patch on #27 not working. It is still the same issue. May I know how to fix and make it working.

    Thank you SO So much! /|\

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    @smethawee the patch in #13 should let you get past the error (but the underlying break will still be in your site config), the patch in #27 will not fix anything but will hopefully make it clearer what part of your site is broken. And then you can fix that hopefully.

    I haven't tried any of the patches so don't know if they actually help in their current state.

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

    @ Lendude, Thank you so much for you added on. No luck for now. We will still need to implement it.

Production build 0.71.5 2024