Cannot autowire service... FileMetadataManagerInterface class couldn't be loaded

Created on 22 March 2024, 8 months ago
Updated 22 June 2024, 5 months ago

Problem/Motivation

On the site where I've encountered this issue, I have File metadata manager โ†’ and this module installed. I tried updating file_mdm to 3.0.0 and this module to 3.7.0 individually and I couldn't due to constraints, but I was able to update them both simultaneously.

However, when I tried updating the database, I got the error:

In DefinitionErrorExceptionPass.php line 51:

  Cannot autowire service "Drupal\imagemagick\EventSubscriber\ImagemagickEventSubscriber": argument "$fileMetadataManager" of method "__construct()" has type "Drupal\file_mdm\FileMetadataManagerInterface" but this class couldn't be loaded. Either it was not found or it is missing a parent class or a trait.

Failed to run drush updb: exit status 1

I found I also wasn't able to clear caches or do much else.

Initially, I was uncertain why this happened, and I thought this was a file_mdm issue, but later I was able to find out what the issue was (relating to autowiring โ€“ Symfony).

To reproduce the issue

- If you don't have both modules, install earlier versions (not the versions mentioned above).
- Update both modules to the versions mentioned above, and try updating the database (or even clearing caches).

Proposed resolution

Will create a merge request.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ› Bug report
Status

Needs review

Version

3.7

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo

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

Merge Requests

Comments & Activities

  • Issue created by @danielzigo
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly mondrake ๐Ÿ‡ฎ๐Ÿ‡น

    What would happen if you run the update from Drupalโ€™s UI instead of Drush? Iโ€™d like to understand if this is a Drush problem only.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo

    Thanks @mondrake.

    If you run the update from the UI, you'd just get the same error. See screenshot.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo
  • Pipeline finished with Failed
    7 months ago
    Total: 172s
    #164095
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom danielzigo
  • Status changed to Needs review 5 months ago
  • I am encountering a similar problem, but it is stopping the site opening on an open social distribution with the error:

    Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "Drupal\file_mdm\FileMetadataManagerInterface". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).

    I have tried adding File metadata manager with composer, but that fails with:

    Problem 1
    - Root composer.json requires drupal/file_mdm ^3.1, found drupal/file_mdm[dev-3.1.x, 3.1.0-alpha1, ..., 3.1.x-dev] but these were not loaded, likely because it conflicts with another require.
    Problem 2
    - drupal/image_effects 3.4.0 requires drupal/file_mdm ^2.5 -> found drupal/file_mdm[dev-2.x, 2.5.0, 2.6.0, 2.x-dev (alias of dev-2.x)] but it conflicts with your root composer.json require (^3.1).
    - goalgorilla/open_social 12.4.2 requires drupal/image_effects 3.4.0 -> satisfiable by drupal/image_effects[3.4.0].
    - goalgorilla/open_social is locked to version 12.4.2 and an update of this package was not requested.

    I think this must be related to your issue.

Production build 0.71.5 2024