When I do clear cache using command line & refresh page on Frontend 1st time it gives below exception.

1 exception(s): Exception #0 (RuntimeException): The path "D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php.6260" cannot be renamed into "D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php" Warning!rename(D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php.6260,D:/wamp/www/magento2/var/generation/Magento/Checkout/Model/Session/Interceptor.php): The process cannot access the file because it is being used by another process. (code: 32)

When i refresh same page again/2nd time it loads page proper. What will be cause for above exception?

  • Did you find any stuff?
    – Gem
    Dec 20 '18 at 7:31

My best guess is that while the setup:di:compile compilation process is running and Magento is processing requests (e.g. tries to bootstrap), this exception might appear.


  • enable maintenance mode
  • stop cron processing
  • deploy your changes (run compilation, static content deploy, etc)

From my perspective this is not a bug, but imperfect deploy process.

I will try to update the answer if I found out any more details.


Improper deployment process leads to this kind of error, just remove all the files from var/generation folder and run a setup:upgrade command, this issue must be resolved after this.This works for me.


try to remove everything from var/generation folder, and execute that commands: php bin/magento setup:upgrade php bin/magento setup:di:compile if you still get the error please check var/exception.log for more informations

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.