I upgraded to latest Pathauto (&Token) today, in latest Drupal 8 release.

when I clicked Edit on a book page, I got the following error
-- I then downgraded to Pathauto 1.6 and editing worked fine again.

TypeError: Argument 5 passed to Drupal\pathauto\AliasUniquifier::__construct() must implement interface Drupal\path_alias\AliasManagerInterface, instance of Drupal\Core\Path\AliasManager given,
called in .../core/lib/Drupal/Component/DependencyInjection/Container.php
on line 285 in Drupal\pathauto\AliasUniquifier->__construct() (line 66 of .../modules/pathauto/src/AliasUniquifier.php)

#0 .../core/lib/Drupal/Component/DependencyInjection/Container.php(285):
Drupal\pathauto\AliasUniquifier->__construct(Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\pathauto\AliasStorageHelper), Object(Drupal\Core\Extension\ModuleHandler), Object(Drupal\Core\Routing\RouteProvider), Object(Drupal\Core\Path\AliasManager))
...

Steve

CommentFileSizeAuthor
#16 3131460-15.patch1.71 KBankitv18

Issue fork pathauto-3131460

Command icon 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

saweyer created an issue. See original summary.

joelpittet’s picture

Version: 8.x-1.7 » 8.x-1.x-dev
Priority: Normal » Major

Bumping the version to -dev and priority major.

I did an accidental similar thing on menu_position release recently, should be a straightforward fix. I'll look into it shortly.

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

Did you clear caches after updating? You might still have old service definitions.

joelpittet’s picture

Sorry, so far clearing cache worked. @Berdir on menu_position I added hook_post_update_NAME to force cache clear, maybe something you could do too for service changes?

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...

berdir’s picture

Yeah. I think everyone should always clear caches on code changes, but I tend to forgot that too many people don't, and I think update.php doesn't clear caches if there are no updates, which is awkward. I find adding empty post updates an ugly solution, as every executed post update needs to be stored basically forever in drupal and compared against the list of defined updates to see if there's something that still needs to run.

An easier option is to make new arguments optional with a \Drupal::service() fallback like the core BC pattern, then it works even without a cache clear. But that wasn't an option here as we really did change the argument and had to, it's the same thing with a new name/namespace.

If someone provides a patch to add a post update then I'm open to commit that.

joelpittet’s picture

Status: Postponed (maintainer needs more info) » Active

Yeah they are a bit messy but don't bump the schema for cache clears, so slightly nicer in some ways, I don't know.

I'll let someone else who comes up with this issue to create a patch with a post update hook, setting this to Active as it seems like cache clear is the solution, feel free to set it back if you still need more info.

saweyer’s picture

I usually Flush Caches (from Admin menu) before Run Updates -- not 100% sure this time.

Steve

Robhern135’s picture

Just dropping in to say that I found this same issue, and clearing all caches fixed it.

mturner20’s picture

Clearing all caches solved this error for me also!

saweyer’s picture

I installed latest (1.8) today, did Flush Caches -- no problems. Steve

luismagr’s picture

Me too. I solved the problem clearing the cache

capricorn1’s picture

Similar in my case except I had updated with Composer. There was an additional database update afterward, which I didn't find out about due to troubles logging in after moving to a new server. After doing the update and clearing all caches, the error went away.

sershevchyk’s picture

I try to update drupal core and modules and have an error when I run drush updb -y (cache was cleared) command

Performing system_update_8901                                                                                                                                                                                                                      [ok]
TypeError: Argument 5 passed to Drupal\pathauto\AliasUniquifier::__construct() must implement interface Drupal\path_alias\AliasManagerInterface, instance of Drupal\Core\Path\AliasManager given, called in /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in /app/docroot/modules/contrib/pathauto/src/AliasUniquifier.php on line 66 #0 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\pathauto\AliasUniquifier->__construct(Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\pathauto\AliasStorageHelper), Object(Drupal\Core\Extension\ModuleHandler), Object(Drupal\Core\Routing\RouteProvider), Object(Drupal\Core\Path\AliasManager))
#1 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'pathauto.alias_...')
#2 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(434): Drupal\Component\DependencyInjection\Container->get('pathauto.alias_...', 1)
#3 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(237): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#4 /app/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, 'pathauto.genera...')
#5 /app/docroot/core/lib/Drupal.php(158): Drupal\Component\DependencyInjection\Container->get('pathauto.genera...')
#6 /app/docroot/modules/contrib/pathauto/pathauto.module(86): Drupal::service('pathauto.genera...')
#7 [internal function]: pathauto_entity_insert(Object(Drupal\ultimate_cron\Entity\CronJob), 'ultimate_cron_j...')
#8 /app/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('pathauto_entity...', Array)
#9 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(349): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_insert', Array)
#10 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(535): Drupal\Core\Config\Entity\ConfigEntityStorage->invokeHook('insert', Object(Drupal\ultimate_cron\Entity\CronJob))
#11 /app/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php(460): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\ultimate_cron\Entity\CronJob), false)
#12 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(263): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\ultimate_cron\Entity\CronJob))
#13 /app/docroot/core/lib/Drupal/Core/Entity/EntityBase.php(395): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\ultimate_cron\Entity\CronJob))
#14 /app/docroot/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(616): Drupal\Core\Entity\EntityBase->save()
#15 /app/docroot/modules/contrib/ultimate_cron/src/CronJobDiscovery.php(117): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#16 /app/docroot/modules/contrib/ultimate_cron/src/CronJobDiscovery.php(61): Drupal\ultimate_cron\CronJobDiscovery->ensureCronJobExists(Array, 'content_lock_ti...')
#17 /app/docroot/modules/contrib/ultimate_cron/ultimate_cron.module(190): Drupal\ultimate_cron\CronJobDiscovery->discoverCronJobs()
#18 [internal function]: ultimate_cron_modules_installed(Array, false)
#19 /app/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('ultimate_cron_m...', Array)
#20 /app/docroot/core/lib/Drupal/Core/Extension/ModuleInstaller.php(347): Drupal\Core\Extension\ModuleHandler->invokeAll('modules_install...', Array)
#21 /app/docroot/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#22 /app/docroot/modules/contrib/admin_toolbar/admin_toolbar_tools/admin_toolbar_tools.install(13): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array)
#23 phar:///usr/local/bin/drush/commands/core/drupal/update.inc(65): admin_toolbar_tools_update_8001(Array)
#24 phar:///usr/local/bin/drush/commands/core/drupal/batch.inc(151): drush_update_do_one('admin_toolbar_t...', 8001, Array, Object(DrushBatchContext))
#25 phar:///usr/local/bin/drush/commands/core/drupal/batch.inc(97): _drush_batch_worker()
#26 phar:///usr/local/bin/drush/includes/batch.inc(98): _drush_batch_command('564')
#27 phar:///usr/local/bin/drush/commands/core/drupal/update.inc(239): drush_batch_command('564')
#28 phar:///usr/local/bin/drush/commands/core/core.drush.inc(1237): _update_batch_command('564')
#29 phar:///usr/local/bin/drush/includes/command.inc(422): drush_core_updatedb_batch_process('564')
#30 phar:///usr/local/bin/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#31 phar:///usr/local/bin/drush/includes/command.inc(199): drush_command('564')
#32 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#33 phar:///usr/local/bin/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#34 phar:///usr/local/bin/drush/includes/startup.inc(465): drush_main()
#35 phar:///usr/local/bin/drush/includes/startup.inc(369): drush_run_main(false, '/', 'Phar detected. ...')
#36 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#37 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#38 {main}

In this log I see module admin_toolbar_tools, mayve problem there

ankitv18’s picture

I just upgraded to Drupal Core Version 8.9.13 and eventually updated the pathauto to 1.8
Running composer update upgrade the pathauto too.
TypeError: Argument 5 passed to Drupal\pathauto\AliasUniquifier::__construct() must implement interface Drupal\path_alias\AliasManagerInterface, instance of Drupal\Core\Path\AliasManager given.
+1 for #13
Clearing cache multiple times still facing this issue.

ankitv18’s picture

Assigned: Unassigned » ankitv18
ankitv18’s picture

StatusFileSize
new1.71 KB

Please test & review this patch for this constructor issue.

ankitv18’s picture

Assigned: ankitv18 » Unassigned
Status: Active » Needs review

berdir’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Needs review » Fixed

This change is not correct, this is the old, deprecated class, the new should work since Drupal 8.8 but you must update first. Update to Drupal 8.9 with an older version. (Or by using the patch, but then you can remove that again).

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.