we see

Warning: include(): Filename cannot be empty

in our logs

and there is hardly a trace (other then "app/code/core/Mage/Core/Block/Template.php on line 24") ...

ERR (3): Warning: include(): Filename cannot be empty in /app/code/core/Mage/Core/Block/Template.php on line 241
ERR (3): Warning: include(): Failed opening '' for inclusion (include_path= many directories here)

question: is there a way to log the calling function or log the calling class or calling file?

This way we hope! to find out what is causing this error

  • show full log...
    – Amit Bera
    Commented Jan 28, 2015 at 7:54
  • What do you mean? We have log enabled etc.
    – snh_nl
    Commented Jan 28, 2015 at 7:59
  • just log $includeFilePath before inclue $includeFilePath; line in Template.php Commented Jan 28, 2015 at 8:13
  • thanks. But won't this be the empty tring like the error statement? I mean, I would eventually be logging an empty string (See error). THis is why I am trying to find out the calling class or function
    – snh_nl
    Commented Jan 28, 2015 at 9:12

2 Answers 2


We solved this by adding

Mage::Log("Function <NAME HERE> called from: " . get_class($this) );
Mage::log(Mage::printDebugBacktrace(), null, 'backtrace.log'); //or you can even log the backtrace

where 'Mage::printDebugBacktrace()' was grabbed from here


This way we had some more info to go by ...


I have the same problem once in a while, the problem is always a missing template file. Unfortunately the error messsage with its printed stack trace does not reveal much, so you don't know which template file actually is missing.

If you use XDebug, you can set a conditional breakpoint at /app/code/core/Mage/Core/Block/Template.php line 241 with the condition $includeFilePath=='' and then when it halts, inspect the $filename variable to see which file should be included. Looking at the variables in the call stack will show you more information about the block and where it is in the layout.

However, this is still annoying, so I started to write a developer module for more meaningful error messages: https://github.com/schmengler/DebugErrors "Filename cannot be empty" is the first error it covers.

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.