Problem/Motivation

Facing the following fatal error

In Container.php line 210:
                                                                                                                       
  Circular reference detected for service "date.formatter", path: "entity_reference_revisions.orphan_purger -> date.f  
  ormatter -> date.formatter". 

Steps to reproduce

Install the "Paragraph" module that has dependency to install "Entity Reference Revisions" module,
And configure a multilingual Drupal 10 website with two or more languages,
Then execute ./vendor/bin/drush updb (Drush 12)
Then the "Circular reference detected for service" fatal error shows up

Proposed resolution

Manage the Circular reference of services in other ways

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Comments

lobodacyril created an issue. See original summary.

lobodakyrylo’s picture

Just want to notice that it worked on Drupal 9.

lobodakyrylo’s picture

StatusFileSize
new2.15 KB

If I remove injection from Drush command class, it solves the issue.

lobodakyrylo’s picture

Status: Active » Needs review
chris64’s picture

@lobodacyril, doubtless the orphan purger service need to be called to see this problem appends. Not always appends with drush updb with the modules Entity Reference Revisions and Paragraphs. Furthermore in my opinion no + arguments: [ ].

chris64’s picture

Please, could you provide a more complete stack trace?

lussoluca’s picture

It seems related to Drush itself.
I have a custom Drush command with its drush.services.yml, and I have the error. If I delete the drush.services.yml file (and load required services using \Drupal::service(...)), it works.

benstallings’s picture

Status: Needs review » Closed (outdated)

Claude Code says:

Assessment: Reject this patch. It's outdated and a regression on multiple fronts.

1. Targets files that no longer exist. The patch modifies drush.services.yml and src/Commands/EntityReferenceRevisionsCommands.php. The current codebase has neither — the Drush commands were modernized in commit c9adf15 (#3474265) and now live at src/Drush/Commands/EntityReferenceRevisionsCommands.php with no drush.services.yml at all. The class uses AutowireTrait for dependency injection, which eliminates the need for a services YAML file entirely.
2. Replaces DI with static service calls. The patch swaps constructor-injected $this->purger for \Drupal::service(...) calls — the opposite of Drupal best practices. The current code already has the ideal pattern: constructor injection via AutowireTrait.
3. Removes the constructor entirely. This means no parent::__construct() call, which is required by DrushCommands.

This patch appears to have been written against a much older version of the module, before the Drush modernization. It would fail to apply cleanly, and even if forced, would be a downgrade from the current implementation.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.