Provide useful error message for: The "" plugin does not exist on Drupal 6 / 7 migrations

Created on 18 April 2022, about 2 years ago
Updated 27 March 2024, 3 months ago

Problem/Motivation

When I run
drush migrate:import upgrade_d7_field_instance --migrate-debug
upgrade_d7_field_instance yml is generated by migrate upgrade without any modification,
I have the following errors:

In DiscoveryTrait.php line 53:

  The "" plugin does not exist. Valid plugin IDs for Drupal\migrate\Plugin\Mi  
  gratePluginManager are: addressfield, block_plugin_id, block_region, block_  
  settings, block_theme, block_visibility, field_type, process_field, field_f  
  ormatter_settings_defaults, d6_field_instance_defaults, d6_field_instance_o  
  ption_translation, d6_field_field_settings, field_instance_widget_settings,  
   d6_field_option_translation, field_settings, d6_field_type_defaults, field  
  _bundle, d7_field_instance_defaults, d7_field_instance_option_translation,   
  d7_field_instance_settings, d7_field_option_translation, d7_field_settings,  
   d7_field_type_defaults, d7_field_permission_settings, d6_field_file, file_  
  uri, filter_id, filter_settings, filter_format_permission, geofield_d7d8, g  
  eofield_field_settings, geofield_latlon, geofield_wkt, google_analytics_vis  
  ibility_pages, google_analytics_visibility_roles, d6_imagecache_actions, in  
  line_entity_form_field_instance_settings, field_link, link_options, link_ur  
  i, d6_nodewords_entities, d7_metatag_entities, array_build, callback, conca  
  t, default_value, download, entity_exists, explode, extract, file_copy, fla  
  tten, format_date, get, log, machine_name, make_unique_entity_field, menu_l  
  ink_parent, migration_lookup, null_coalesce, route, skip_on_empty, skip_row  
  _if_not_set, static_map, sub_process, substr, urlencode, debug, node_comple  
  te_node_lookup, node_complete_node_revision_lookup, node_complete_node_tran  
  slation_lookup, array_pop, array_shift, default_entity_value, dom, dom_appl  
  y_styles, dom_migration_lookup, dom_remove, dom_select, dom_str_replace, en  
  tity_generate, entity_lookup, entity_value, file_blob, gate, merge, multipl  
  e_values, service, single_value, skip_on_value, str_replace, transliteratio  
  n, transpose, node_update_7008, path_set_translated, d6_url_alias_language,  
   d6_path_redirect, d7_path_redirect, d7_redirect_source_query, search_confi  
  guration_rankings, system_update_7000, timezone, forum_vocabulary, convert_  
  tokens, profile_field_settings, user_langcode, user_update_8002, d6_profile  
  _field_option_translation, user_update_7002, field_collection_field_instanc  
  e_settings, field_collection_field_settings, paragraphs_field_instance_sett  
  ings, paragraphs_field_settings, paragraphs_lookup, paragraphs_process_on_v  
  alue

Steps to reproduce

There can be various reasons like core or contrib module bugs or migration misconfigurations causing this error message.
The problem is, that the error message is useless as it contains no helpful information WHAT went wrong WHERE.

Proposed resolution

Add more details to the error message, so the message is helpful and allows finding the root cause of the error.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

  • Provide more details on 'The "" plugin does not exist' Migration error messages.
  • πŸ› Bug report
    Status

    Needs work

    Version

    11.0 πŸ”₯

    Component
    MigrationΒ  β†’

    Last updated about 3 hours ago

    Created by

    πŸ‡ΊπŸ‡ΈUnited States Kenzomus

    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.

    • πŸ‡©πŸ‡ͺGermany Grevil

      Patch from #26 still perfectly applies on 11.x.

    • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

      Also with this patch enabled, the root cause seems to be that an array containing the plugin arrays is passed to the method where we added the exception.
      The array with the "plugin" key is one level deeper. The question is, why this happens!

      Example:
      drush migrate:import --group=xyz --continue-on-failure

      throws this exception with the patch applied

      Missing required 'plugin' property for 'vid' in migration: 'upgrade_d7_taxonomy_vocabulary'

      because the following array in array is passed:

      array(2) {
        [0]=>
        array(6) {
          ["plugin"]=>
          string(24) "make_unique_entity_field"
          ["source"]=>
          string(12) "machine_name"
          ["entity_type"]=>
          string(19) "taxonomy_vocabulary"
          ["field"]=>
          string(3) "vid"
          ["length"]=>
          int(30)
          ["migrated"]=>
          bool(true)
        }
        [1]=>
        array(2) {
          ["plugin"]=>
          string(16) "forum_vocabulary"
          ["machine_name"]=>
          string(6) "forums"
        }
      }

      In Migration.php line 733:

      The .yml part looks like this:

      [...]
      source:
        plugin: d7_taxonomy_vocabulary
      process:
        vid:
          -
            plugin: make_unique_entity_field
            source: machine_name
            entity_type: taxonomy_vocabulary
            field: vid
            length: 30
            migrated: true
          -
            plugin: forum_vocabulary
            machine_name: forums
      [...]
      
    Production build 0.69.0 2024