I'm trying to run php bin/magento setup:di:compile-multi-tenant on a Magento CE 2.0.10 with sample data installed. I don't have anything else in this Magento installation. I use php 7.0.8.

 Source class "\Magento\Catalog\Model\Product\OptionInterface" for "\Magento\Catalog\Model\Product\OptionInterfacePersistor" generation does not exist.

The permissions should be ok. With root I get same error.

Originally I've installed Magento from archive. Than I used composer to update the project with a module (the module is gone now). After installing from archive I did set production mode, but I didn't spotted any errors. I'm not sure if the error was or wasn't there. One thing is to repeat the installation which I'll do.

Compiling with setup:di:compile will work (as in execute successfully the command) but in Magento 2.0.x is bugged as far as I know. Anyway the plugins in that module I was talking do not work (in developer mode work as expected).

Anyone got into this OptionInterfacePersistor error when trying to compile on a Magento 2.0.x ?

update I installed again 2.0.10 sample from archive. I set production mode successfully. Run again php bin/magento setup:di:compile-multi-tenant and worked. I run composer update -vvv. Run php bin/magento setup:di:compile-multi-tenant and failed with same error. In composer update I see a few external packages updated.

These are all packages updated:

- Removing phpunit/php-token-stream (1.4.8)
- Installing phpunit/php-token-stream (1.4.9)
- Removing symfony/config (v2.8.11)
- Installing symfony/config (v2.8.14)
- Removing symfony/yaml (v2.8.11)
- Installing symfony/yaml (v2.8.14)
- Removing sebastian/comparator (1.2.0)
- Installing sebastian/comparator (1.2.2)
- Removing seld/jsonlint (1.4.1)
- Installing seld/jsonlint (1.5.0)
- Removing fabpot/php-cs-fixer (v1.12.2)
- Installing fabpot/php-cs-fixer (v1.12.4)
- Removing psr/log (1.0.1)
- Installing psr/log (1.0.2)
- Removing symfony/event-dispatcher (v2.8.11)
- Installing symfony/event-dispatcher (v2.8.14)
- Removing symfony/filesystem (v2.8.11)
- Installing symfony/filesystem (v2.8.14)
- Removing symfony/finder (v2.8.11)
- Installing symfony/finder (v2.8.14)
- Removing symfony/process (v2.8.11)
- Installing symfony/process (v2.8.14)
- Removing symfony/stopwatch (v3.1.4)
- Installing symfony/stopwatch (v3.1.7)

Still don't know the cause of this.

  • I had this after I updated composer to version 1.3.1 on my development machine and tried to compile on a server with version 1.2-dev (034f1cf591e9061500488a4c354050cf3ea4965f) When I rolled back to version 1.12 on my development machine, reinstalled every plugin by deleting composer.lock and vendor/composer/installed.json, composer update and compiled the code on the server again the problem was gone.
    – user2450
    Commented Jan 27, 2017 at 16:51
  • How you have rollback the composer?
    – Saphal Jha
    Commented Jun 16, 2017 at 10:21
  • composer self-update --help There is a --rollback option. Commented Jun 16, 2017 at 10:31
  • Disregard my previous comment. You just add the version you want to the package in composer.json and run composer update -vvv Commented Jun 16, 2017 at 13:47

2 Answers 2


I had the same error, the fabpot/php-cs-fixer package seems te be cause. If you run 'composer update' again you should get version 1.13.0 of this package.


After upgrading from 2.0.4 to 2.0.10 I had exactly the same error so I also installed the archive version of 2.0.10 and switched it to production mode with no errors. Switched it back to developer, ran 'composer upgrade' and switched to production mode, again with no errors.

I then ran 'composer update' on the 2.0.10 version with the error. The only update was 'fabpot/php-cs-fixer' from 1.12.4 to 1.13.0

Retried switching to production mode on this shop, and no errors this time.

So it seems that version 1.12.4 and Magento 2.0.10 are not working well together.


The workaround for now is to use composer 1.2.4 and avoid using composer 1.3.x.

I have done some tests to verify my comment from 27 January.

In comparison with composer 1.2.4, the Magento 2.0.10 code has these changed files when installed with composer 1.3.0:

modified:   composer.lock
modified:   vendor/composer/ClassLoader.php
modified:   vendor/composer/autoload_real.php
modified:   vendor/composer/installed.json

The problem appears in vendor/composer/ClassLoader.php. This part is removed from the file in Composer\Autoload\ClassLoader::findFile():

   // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
   if ('\\' == $class[0]) {
       $class = substr($class, 1);

Adding this to the code reveals the problem classes:

   // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
   if ('\\' == $class[0]) {
       echo $class . "\n";
       $class = substr($class, 1);

These are the results:


And this is the problem:

<preference for="Magento\Catalog\Api\ProductLinkManagementInterface" type="Magento\Catalog\Model\ProductLink\Management" />
<preference for="Magento\Catalog\Api\Data\ProductLinkInterface" type="Magento\Catalog\Model\ProductLink\Link" />
<preference for="\Magento\Catalog\Api\CategoryLinkManagementInterface" type="\Magento\Catalog\Model\CategoryLinkManagement" />
<preference for="Magento\Catalog\Api\Data\ProductWebsiteLinkInterface" type="Magento\Catalog\Model\ProductWebsiteLink" />
<preference for="Magento\Catalog\Api\ProductWebsiteLinkRepositoryInterface" type="Magento\Catalog\Model\ProductWebsiteLinkRepository" />
<preference for="\Magento\Catalog\Api\CategoryLinkRepositoryInterface" type="\Magento\Catalog\Model\CategoryLinkRepository" />
<preference for="Magento\Catalog\Api\Data\ProductCustomOptionInterface" type="Magento\Catalog\Model\Product\Option" />
<preference for="Magento\Catalog\Api\ProductCustomOptionRepositoryInterface" type="\Magento\Catalog\Model\Product\Option\Repository" />

See the leading \ before two of the problem classes?

Now, to be compatible with composer 1.3.x the Magento team needs to find and replace all occurrences of <preference for="\\([^"]+)" type="\\([^"]+)"\s*/> with <preference for="$1" type="$2" />.

I will create a pull request for them and keep you posted.


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.