The «Class “Mage” not found» issue has been recently a headache in most of our projects. I could say that there was a specific change eventually (either a package update, package installation, configuration change…) that make this error appear. The problem is not the error itself, the problem is that this error is not providing any type of information at all. As a consequence, it makes it very difficult to investigate what the actual issue is.

I will update this post periodically, adding the possible reasons for this error to happen. I’ll start with the first reason we found yesterday:

  • Possible reason 1: a bad formated XML file

Yesterday we apply a change in a layout xml file. There was an issue on the opening tag of the xml file. Usually, a xml file should have in the first line something like:

<?xml version="1.0"?>

Well, we had this:

g!xml version="1.0"?>

We found the error because we knew that someone had modified that file. While checking it, we notice this. So stupid. But Magento wouldn’t provide any information. I will create a bash script to find all the xml files and check the format. Next time it’ll be easier to find a problem like this.

This post will be updated in a regular basis. Don’t hesitate commenting and explaining how you’ve solved this type of issue.


Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.