Uncaught error with menu_link_parent process plugin

Created on 10 January 2025, about 1 month ago

Problem/Motivation

I get this error (and partial stack trace):

(Uncaught Throwable) Drupal\Component\Plugin\Exception\PluginNotFoundException: Plugin ID 'migrate_sandbox' was not found. in Drupal\migrate\MigrateLookup->lookup() (line 45 of /var/www/html/docroot/core/modules/migrate/src/MigrateLookup.php).

main() (Line: 45)
Drupal\migrate\MigrateLookup->lookup() (Line: 144)
Drupal\migrate\Plugin\migrate\process\MenuLinkParent->transform() (Line: 453)
Drupal\migrate\MigrateExecutable->processPipeline() (Line: 221)
Drupal\migrate\MigrateExecutable->import() (Line: 467)
...

From MenuLinkParent.php:

    $lookup_result = $this->migrateLookup->lookup($this->migration->id(), [$parent_id]);

where $this->migrateLookup is the migration lookup service.

Steps to reproduce

Short version for now. I will add detail later if needed.

I chose the option to populate the sandbox from an actual migration. Part of the process section of that migration:

  parent:
    plugin: menu_link_parent
    source:
      - plid
      - '@menu_name'
      - parent_link_path

I have not tried, but I expect the same error from the core d7_menu_links.yml migration (in the menu_link_content module).

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

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

Comments & Activities

  • Issue created by @benjifisher
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area
  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    I just added ✨ Add lookup_migrations configuration to menu_link_parent process plugin Active . If that issue gets fixed, then it will provide a work-around for the particular example I gave in this issue. But there might be other process plugins (core, contrib, custom) that try to instantiate the migrate_sandbox migration, so I hope that the issue can be fixed in this module.

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    Very interesting bug, @benjifisher. menu_link_parent is an odd duck. I never added demo configuration for this one. I wonder if that was because I tried and ran into this and gave up? More likely it looked like it wouldn't work in the sandbox and I never even tried to come up with a demo.

    Making the process plugin itself configurable would (probably) allow things to work without failing.

    How would we fix this withing Migrate Sandbox...

    There is no migrate_sandbox migrate plugin. That's kind of by design in that this is trying to be very separate from everything else. But we're seeing that there are drawbacks to circumventing the plugin system a bit. We end up getting an executable without using the migration plugin manager. The funny business happens around here: https://git.drupalcode.org/project/migrate_sandbox/-/blob/1.1.x/src/Form...

    One thing I could do is look at making this all cleaner.

    But I'd bet we could add a very simple stubby migration plugin to the module and trick this process plugin into running without failing.

  • πŸ‡ΊπŸ‡ΈUnited States benjifisher Boston area

    Yes, I think a stub migration in migrate_sandbox/migrations/ and then adding the process pipelines in migrate_sandbox_migration_plugins_alter() is how I would try to do it.

    I have never checked: does the current implementation avoid creating map and message tables?

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    > does the current implementation avoid creating map and message tables?

    Yes, the module provides an id_map plugin that extends the null plugin.

    https://git.drupalcode.org/project/migrate_sandbox/-/blob/1.1.x/src/Plug...

    It spits messages out with the Drupal messenger, but nothing goes to the db (he says as he proudly points at test coverage).

Production build 0.71.5 2024