Running any command

s:up , s:di:c s:s:d -f cache getting error

Class Magento\Webapi\Model\Cache\Type\WebApi\Interceptor does not exist

And like below images, any help will be appreciate.enter image description here

2 Answers 2


Please, check that interceptor class on your server:

ls -la generated/code/Magento/Webapi/Model/Cache/Type/Webapi/Interceptor.php

(from Magento root dir.)

In case it has a wrong permissions change it according your needs (usually make it accessible by web-server user is enough).

Another case that interceptor class used somewhere in your code directly (or in third-party extensions) but it must not be used directly. Use grep on your code directory to check it.

Another case is when file totally missed from the Magento (missed base class Magento\Webapi\Model\Cache\Type\WebApi). In that case I'll recommend you to update Magento using composer.

  • I just checked Webapi folder does not exist in generated/code/Magento/. what can I do now
    – irshad
    Dec 12, 2019 at 5:49
  • @irshad check that your folder has right permissions (so magento can create that file in the future) and because you can’t run setup:di:compile i’ll recommend you to use a hacky way: copy this file from another magento and try to re run setup:di:compile command. Dec 12, 2019 at 6:08
  • awesome, setup:di:compile is running but while running other command s:up and c:c it shows error Fatal error: Class 'Magento\Webapi\Model\Cache\Type\Webapi' not found in /opt/lampp/htdocs/Shopcore/generated/code/Magento/Webapi/Model/Cache/Type/Webapi/Interceptor.php on line 7
    – irshad
    Dec 12, 2019 at 6:46
  • @irshad oh, seems like original class is missed from your system. Try to update while magento using composer. Dec 12, 2019 at 6:48
  • on line number 7 , the code is class Interceptor extends \Magento\Webapi\Model\Cache\Type\Webapi implements \Magento\Framework\Interception\InterceptorInterface
    – irshad
    Dec 12, 2019 at 6:52

You need to flush the DI generated and the Redis too, run these commands to do it:

rm -rf generated/*
redis-cli -n 0 flushall
php -r "echo opcache_reset();"
bin/magento setup:di:compile

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.