Migration of CSV into paragraphs fails with unexpected error

I try to import CSV files into a Drupal 8 installation but I can’t manage to make the relationship to paragraphs appear. I followed the steps of this tutorial but can’t figure out how to make it work. I created a simple test case to find the error:

I extended the regular article content type with a paragraphs field called field_persons for linking each article to a list of persons with roles. This paragraphs entity has to fields called field_name (for now only text) and field_role (taxonomy_term).

The yaml file for paragraphs migration looks like that and import processes without error:

id: article_persons label: Import persons for articles  source:   plugin: csv   delimiter: '|'   enclosure: '"'   path: article_persons.csv   header_row_count: 1   keys:     - id   column_names:     0:       id: 'ID'     1:       name: 'Name'     2:       rol: 'Role'  process:   field_nombre: name   field_para_rol:      plugin: entity_generate     source: role     value_key: name     bundle_key: vid     bundle: rol     entity_type: taxonomy_term     ignore_case: true  destination:   plugin: 'entity_reference_revisions:paragraph'   default_bundle: article_persons 

The yaml file for article migration looks like that and import processes without error:

id: article label: Import articles  source:   plugin: csv   delimiter: '|'   enclosure: '"'   path: articles.csv   header_row_count: 1   keys:     - id   column_names:     0:       id: 'ID'     1:       title: 'Title'     2:       person: 'Persons'  process:   title: title   type:     plugin: default_value     default_value: article   field_person/target_id:      -       plugin: migration_lookup       migration: article_persons       no_stub: true       source: id     -       plugin: extract       index:         - '0'   field_person/target_revision_id:      -       plugin: migration_lookup       migration: article_persons       no_stub: true       source: id     -       plugin: extract       index:         - 1  destination:   plugin: 'entity:node' migration_dependencies:   required:      - article_persons   optional: { } 

But when I try to access the node I get an “unexpected error” with a huge log message:

Error: Call to a member function getEnabledBehaviorPlugins() on null en DrupalparagraphsParagraphViewBuilder->buildMultiple() (línea 37 de /var/www/html/sites/all/modules/paragraphs/src/ParagraphViewBuilder.php) #0 /var/www/html/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(220): DrupalparagraphsParagraphViewBuilder->buildMultiple(Array) #1 [internal function]: DrupalCoreEntityEntityViewBuilder->build(Array) #2 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array) #3 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(195): DrupalCoreRenderRenderer->doRender(Array, false) #4 /var/www/html/core/lib/Drupal/Core/Template/TwigExtension.php(490): DrupalCoreRenderRenderer->render(Array) #5 /var/www/html/sites/default/files/php/twig/5a008e9488529_field.html.twig_9MJB5waMfG4Lcal_NDL6EY6rM/NRByUw7bYmwhNIE9WTZfCRjJ3XUAFBB122RdQTC3JsI.php(128): DrupalCoreTemplateTwigExtension->escapeFilter(Object(DrupalCoreTemplateTwigEnvironment), Array, 'html', NULL, true) #6 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_85d8aba47ed6496a0f2e8e6407c9fc1802c03e707a72d9d0c1465c62e125a308->doDisplay(Array, Array) #7 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(403): Twig_Template->displayWithErrorHandling(Array, Array) #8 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array) #9 /var/www/html/core/themes/engines/twig/twig.engine(64): Twig_Template->render(Array) #10 /var/www/html/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('sites/all/theme...', Array) #11 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(437): DrupalCoreThemeThemeManager->render('field', Array) #12 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(450): DrupalCoreRenderRenderer->doRender(Array) #13 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(195): DrupalCoreRenderRenderer->doRender(Array, false) #14 /var/www/html/core/lib/Drupal/Core/Template/TwigExtension.php(490): DrupalCoreRenderRenderer->render(Array) #15 /var/www/html/sites/default/files/php/twig/5a008e9488529_node.html.twig_fOU7Z1faeO15YpZRrtd-F9Ksv/yHD4dpGBMlI8SMMqQ5z-QVQGNcCrpCuzsSt1E4ShcEU.php(111): DrupalCoreTemplateTwigExtension->escapeFilter(Object(DrupalCoreTemplateTwigEnvironment), Array, 'html', NULL, true) #16 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(432): __TwigTemplate_38fa5b6b1f6bdfd56bb4dba5e7d13d0f61126e79c913612089235f94cf12db1f->doDisplay(Array, Array) #17 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(403): Twig_Template->displayWithErrorHandling(Array, Array) #18 /var/www/html/vendor/twig/twig/lib/Twig/Template.php(411): Twig_Template->display(Array) #19 /var/www/html/core/themes/engines/twig/twig.engine(64): Twig_Template->render(Array) #20 /var/www/html/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('sites/all/theme...', Array) #21 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(437): DrupalCoreThemeThemeManager->render('node', Array) #22 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(195): DrupalCoreRenderRenderer->doRender(Array, false) #23 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): DrupalCoreRenderRenderer->render(Array, false) #24 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(576): DrupalCoreRenderMainContentHtmlRenderer->DrupalCoreRenderMainContent{closure}() #25 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): DrupalCoreRenderRenderer->executeInRenderContext(Object(DrupalCoreRenderRenderContext), Object(Closure)) #26 /var/www/html/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): DrupalCoreRenderMainContentHtmlRenderer->prepare(Array, Object(SymfonyComponentHttpFoundationRequest), Object(DrupalCoreRoutingCurrentRouteMatch)) #27 /var/www/html/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): DrupalCoreRenderMainContentHtmlRenderer->renderResponse(Array, Object(SymfonyComponentHttpFoundationRequest), Object(DrupalCoreRoutingCurrentRouteMatch)) #28 /var/www/html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(108): DrupalCoreEventSubscriberMainContentViewSubscriber->onViewRenderArray(Object(SymfonyComponentHttpKernelEventGetResponseForControllerResultEvent), 'kernel.view', Object(DrupalComponentEventDispatcherContainerAwareEventDispatcher)) #29 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(158): DrupalComponentEventDispatcherContainerAwareEventDispatcher->dispatch('kernel.view', Object(SymfonyComponentHttpKernelEventGetResponseForControllerResultEvent)) #30 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(68): SymfonyComponentHttpKernelHttpKernel->handleRaw(Object(SymfonyComponentHttpFoundationRequest), 1) #31 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): SymfonyComponentHttpKernelHttpKernel->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #32 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): DrupalCoreStackMiddlewareSession->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #33 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): DrupalCoreStackMiddlewareKernelPreHandle->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #34 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupalpage_cacheStackMiddlewarePageCache->pass(Object(SymfonyComponentHttpFoundationRequest), 1, true) #35 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupalpage_cacheStackMiddlewarePageCache->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #36 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): DrupalCoreStackMiddlewareReverseProxyMiddleware->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #37 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): DrupalCoreStackMiddlewareNegotiationMiddleware->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #38 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(657): StackStackedHttpKernel->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true) #39 /var/www/html/index.php(19): DrupalCoreDrupalKernel->handle(Object(SymfonyComponentHttpFoundationRequest)) #40 {main}. 

This bug report seems to indicate that the paragraphs which is referenced doesn’t exist. So it seems to have to do something with the ids, but I can’t figure out what.

Sponsored by SupremePR
This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Migration of CSV into paragraphs fails with unexpected error

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.