Magento – Magento 2: Running any command getting error Class Magento\Webapi\Model\Cache\Type\Web Api\Interceptor does not exist

commanderrormagento2server-setupwebapi

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

Best Answer

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.