I have a site with a custom module that was working fine until just recently but I tried to do a plugin update via CLI and it returned Failed to instantiate component or class "modules\exifreturn\ExifReturn", even though the update did actually complete. But after that, the front and backend of the site were displaying the same error.

I've seen a similar question already about this but the suggested fix in that question isn't working for me. I've also seen some discussion in Discord and have been looking at how NY Studio set up their Devmode repo and as far as I can tell, I've got things set up the same, so not sure why it's not working.

In config/app.php I have:

return [
    'modules' => [
        'exifreturn' => [
          'class' => \modules\exifreturn\ExifReturn::class
    'bootstrap' => ['exifreturn'],

In composer.json I have:

"autoload": {
  "psr-4": {
    "modules\\exifreturn\\": "modules/exifreturn/src/"

and on the server I have this in the modules folder:


Can anyone see what I might be missing?

1 Answer 1


Make sure you have the correct namespace in your modules/exifreturn/src/ExifReturn.php class. From what you show, you should have:

namespace modules\exifreturn;

Right at the top, after <?php. With that in place, run composer dumpautoload.

  • Thanks Oli, composer dumpautoload did it! :)
    – Tyssen
    Commented Jan 19, 2021 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.