Problem/Motivation

I tried updating from 1.2.1 to the latest dev version (568495c194161b43a0a6941b7e1e5f31e6605ded). However, I'm getting the following error when I run drush cr:

Circular reference detected for service "entity_type.manager", path: "asset.css.collection_optimizer -> asset.css.
dumper -> file_system -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.fa
ctory -> plugin.manager.email_builder".

If I revert to 1.2.1, I can clear the cache normally.

I have a multilingual site with two languages installed; I'm only using core i18n modules for translation. I can provide more detailed config if needed.

Comments

ptmkenny created an issue. See original summary.

adamps’s picture

Thanks for the report. I was getting a lot of similar errors and I believe I fixed them with this commit. Please can you check if you still see the error with the latest dev version?

adamps’s picture

Status: Active » Closed (outdated)

Should be fixed as described in #2. Please re-open if you still hit the bug with the latest release

ptmkenny’s picture

Thanks, I can confirm this is fixed in the current dev version!

megadesk3000’s picture

Don't know exactly if this is the same issue, but when i am trying to enable the symfony_mailer module in its 1.x-dev version i get the following error:

www-data@9da9a3bd1635:/app$ drush en symfony_mailer

In Container.php line 147:

  Circular reference detected for service "language_manager", path: "language_request_subscriber -> language_manager -> config.factory -> plugin.manager.email_builder -> entity_type.manager -> string_translation -> strin
  g_translator.locale.lookup".


PHP Fatal error:  Uncaught Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "entity_type.manager", path: "user_last_access_subscriber -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.factory -> plugin.manager.email_builder". in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php:147
megadesk3000’s picture

Status: Closed (outdated) » Needs work
megadesk3000’s picture

Status: Needs work » Active
titouille’s picture

same problem as megadesk3000 on #5. After upgrading to 1.3.0-beta1, I can't add new modules if symfony_mailer is enabled, it cause a Circular reference detected error :

PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "entity_type.manager", path: "user_last_access_subscriber -> entity_type.manager -> string_translation -> string_translator.locale.lookup -> config.factory -> plugin.manager.email_builder".

downgrading to 1.2.1 resolve the problem.

adamps’s picture

Title: On drush cr: Circular reference detected for service "entity_type.manager" » Circular reference on multi-language sites
Priority: Minor » Major

Thanks for the reports. It's not exactly the same issue, because it's no longer related to drush. The cause seems to be multi-language sites - which my test sites are not, so I don't hit it. Strange how each error message is slightly different from the others.

adamps’s picture

This was caused by #3315358: Allow full management of override plugins.

Probably the fix is something like this, partly undoing some changes in the above issue:

  1. Create class MailerConfigOverride with tag config.factory.override, and remove that tag from EmailBuilderManager. Although this class uses EmailBuilderManager, it should not have it injected as that causes the loop.
  2. MailerConfigOverride::loadOverrides() has a hard-coded test to ignore certain entries that are used during initialisation and would cause a loop, probably "core.extension", "symfony_mailer.settings" (see earlier patch that was later revised to the current code). Then it calls \Drupal::service('plugin.manager.email_builder')->loadOverrides().
adamps’s picture

Status: Active » Needs review
StatusFileSize
new5.94 KB

Please can everyone seeing this bug please test this patch?

hswong3i’s picture

@AdamPS confirm #11 working for my DruStack, see https://github.com/drustack/composer-project-website-skeleton/commit/6dd...

Once patch applied and `drush -y cr`, site up and running once again, able to enable other else modules with no issue.

Thank you very much ;-)

hswong3i’s picture

Status: Needs review » Reviewed & tested by the community

  • AdamPS committed 3fc41789 on 1.x
    Issue #3355846 by AdamPS, hswong3i: Circular reference on multi-language...
adamps’s picture

Status: Reviewed & tested by the community » Fixed

Great thanks

Status: Fixed » Closed (fixed)

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

trickfun’s picture

I get same error but I can't apply the patch with dev and 1.3.0-rc1 version.
thank you

kaszarobert’s picture

I met the same problem by installing 1.3.0-rc1 and running drush commands later.

kreatil’s picture

Same or similar issue here after upgrading to 1.3.0-rc1 on Drupal 9.5.10 and PHP 8.1.16

Circular reference detected for service "entity_type.manager", path: "scheduler.manager -> date.formatter -> entity_type.manager -> string_translat  
  ion -> string_translator.locale.lookup -> config.factory -> symfony_mailer.config_override -> plugin.manager.email_builder".