Problem/Motivation
Migrate commands including `drush migrate:status` fail when Pathauto is installed in Drupal 11, due to a Pathauto error:
```
In MigrationPluginManager.php line 118:
The pathauto_pattern plugin must define the source_module property.
```
Steps to reproduce
Set up a migration. Make sure Pathauto is installed, install all Migrate modules, attempt `drush migrate:status`.
Proposed resolution
In the file `/src/Plugin/migrate/source/PathautoPattern.php`:
at line 22, make the following change:
```
#[MigrateSource(
- id: 'pathauto_pattern'
+ id: 'pathauto_pattern',
+ source_module: 'pathauto',
)]
```
This allows migration commands to proceed.
Issue fork pathauto-3635649
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
realsp commentedThanks for the report, @bondjimbond. I reproduced it on Drupal 11.4.8 with Pathauto 8.x-1.15: enabling
migrate_drupalis enough, and every migrate command, includingdrush migrate:status, then fails with:The pathauto_pattern plugin must define the source_module property.Already fixed in 8.x-1.x, but not released
This is the same error as #3588684 (https://www.drupal.org/project/pathauto/issues/3588684). That issue added
source_module: pathautotomigrations/d7_pathauto_patterns.yml, and it was committed to 8.x-1.x in June, after 1.15 came out. Until there is a new release, you can use 8.x-1.x-dev or apply the MR from #3588684. I checked that on 8.x-1.x (fb071b9),drush migrate:statusworks again.The proposed change doesn't work
Core's
#[MigrateSource]attribute has nosource_moduleparameter, so adding it breaks plugin discovery:Error: Unknown named parameter $source_module in ReflectionAttribute->newInstance() (line 22 of.../src/Plugin/migrate/source/PathautoPattern.php)What's still broken on 8.x-1.x
The actual cause is in
PathautoPattern.php. It has both a@MigrateSourceannotation, which setssource_module = "pathauto", and a#[MigrateSource]attribute, which was added in #3553071 (https://www.drupal.org/project/pathauto/issues/3553071). Core reads the attribute first and ignores the annotation, so the plugin definition has nosource_module. The YAML change in #3588684 only fixes the bundled migration. Any other migration tagged "Drupal 7" that usesplugin: pathauto_patternwithout its ownsource_module(a custom or migrate_plus migration, for example) still fails on 8.x-1.x. I confirmed this with a small test migration.Removing the attribute and keeping the annotation fixes it: both the bundled and the custom migration load, and the definition has
source_module:pathauto. This is also what core does: its Drupal 7 source plugins (for examplenode/src/Plugin/migrate/source/d7/Node.php) still use annotations only, because the attribute can't carrysource_module.Next steps
@bondjimbond, was the migration you set up your own migration using the
pathauto_patternsource plugin? If so, you'll hit the remaining problem even on 8.x-1.x, and this issue is worth keeping open for the fix above. If not, this is a duplicate of #3588684, and what you need is a new release.Maintainers: if you agree, I can open an MR on this issue that removes the attribute (keeping the annotation and the YAML line) and adds a Kernel test checking that
pathauto_patternhassource_module. I'd also suggest updating the issue title and summary to describe that remaining problem.AI disclosure
Investigated with help from Claude Code; results verified manually.
Comment #4
realsp commentedComment #5
bondjimbond commented@realsp
It was my own migration, without any specific reference to pathauto - migrating a custom content type with very few fields. Pathauto just gets in the way of any migration at all.
Comment #6
berdirThis has already been fixed in dev and is now in 8.x-1.16