On deleting all cache as

rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/*

I got below error

Warning: ltrim() expects parameter 1 to be string, object given in vendor\magento\framework\Code\Generator\EntityAbstract.php on line 152

Notice: Uninitialized string offset: 0 in vendor\magento\framework\Autoload\ClassLoaderWrapper.php on line 81

Notice: Uninitialized string offset: 0 in vendor\composer\ClassLoader.php on line 317

Notice: Uninitialized string offset: 0 in vendor\composer\ClassLoader.php on line 349
exception 'RuntimeException' with message 'Source class "" for   "Magento\Framework\App\Response\Http\Interceptor" generation does not exist.'
in vendor\magento\framework\Code\Generator.php:185 Stack trace:     #0  
vendor\magento\framework\Code\Generator.php(112): Magento\Framework\Code\Generator->tryToLoadSourceClass('Magento\\Framewo...', Object(Magento\Framework\Interception\Code\Generator\Interceptor)) #1 
vendor\magento\framework\Code\Generator\Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\\Framewo...') #2 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\\Framewo...') #3 
vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(93): spl_autoload_call('Magento\\Framewo...') #4 
vendor\magento\framework\ObjectManager\Factory\Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array) #5 
vendor\magento\framework\ObjectManager\Factory\Compiled.php(130): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Framewo...') #6 
vendor\magento\framework\ObjectManager\Factory\Compiled.php(67): Magento\Framework\ObjectManager\Factory\Compiled->get('Magento\\Framewo...') #7     
vendor\magento\framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Magento\\Framewo...', Array) #8 
vendor\magento\framework\App\Bootstrap.php(233): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array) #9 
index.php(38): Magento\Framework\App\Bootstrap->createApplication('Magento\\Framewo...') #10 {main}

What are the reasons behind this issue?

Can you suggest me the possible solutions for this issue?


You have to first remove var folder.

Run command, php bin/magento setup:di:compile

After remove var folder give permission to var folder,

chmod -R 775 var/generation/ var/cache/ var/full_page/

Check again.

  • 4
    The error solved for me on compiling modules using php bin/magento setup:di:compile – sagar sapkota Oct 25 '16 at 5:03
  • I have same issue and my issue also resolved using php bin/magento setup:di:compil comand – PMB Jan 6 '18 at 6:26

If you're still having issues after compiling, removing the var/di folder & contents usually does the trick for me. No idea what actually causes this to happen though, I frequently run into it and would very much like to know.

  • 1
    Have you managed to find out why this is happening? – Stevie G Jun 27 '17 at 9:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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