Hello community.
I would like to report an issue related to the "bin/magento setup:di:compile" command.
Since upgrading to version 2.4.6, I have encountered the following error:
Error message: /vendor/magento/module-inventory-sales-async-order/Model/ReservationExecution.php on line 19 Interface "Magento\InventorySales\Model\ReservationExecutionInterface" not found. #0 /Users/x/PhpstormProjects/development/src/vendor/composer/ClassLoader.php(582): include()
Steps to reproduce the error:
Expected behavior: The "bin/magento setup:di:compile" command should execute successfully without any errors.
Current behavior: When executing the "bin/magento setup:di:compile" command, an error occurs indicating a missing interface. The interface "Magento\InventorySales\Model\ReservationExecutionInterface" in the file "/vendor/magento/module-inventory-sales-async-order/Model/ReservationExecution.php" cannot be found.
This error prevents me from successfully running the compilation script and impacts the functionality of the Magento installation.
Thank you for your assistance in addressing this issue. I look forward to your response and working together to resolve the error.
Hello @mschauerhe132f
You can work around the issue by manually creating the interface "Magento\InventorySales\Model\ReservationExecutionInterface". To do this, open the file "/vendor/magento/module-inventory-sales-async-order/Model/ReservationExecution.php" and add the following code to the top of the file:
I had the same issue, you probably removed the inventory (MSI) modules entirely via composer (the `replace` hack). In Magento 2.4.6, `magento/module-inventory-sales-async-order` has been added as new inventory module.
You need to add it to the `replace` section in `composer.json` alongside with the other inventory modules
Here are the key steps I recommend to resolve the "interface not found" error when running bin/magento setup:di: compile after upgrading to Magento 2.4.6:
This appears to be a version compatibility issue. Updating modules, clearing caches, and reinstalling dependencies should resolve it.
Was there ever a solution to this issue?
I'm experiencing exactly the same error after upgrading from 2.4.3 to 2.4.6
However we are using commerce cloud.
I have a "require" section in the composer.json file but if I do the suggested and add module-inventory-sales-async-order to it then I get the following error:
Problem 1 - magento/magento-cloud-template is present at version 2.4.6 and cannot be modified by Composer - Only one of these can be installed: magento/module-inventory-sales-async-order[100.2.0], magento/magento-cloud-template[2.4.6]. magento/magento-cloud-template replaces magento/module-inventory-sales-async-order and thus cannot coexist with it. - magento/module-inventory-sales-async-order is locked to version 100.2.0 and an update of this package was not requested.
I have also tried the other solution of removing content in var & generated code before running setup:upgrade and then setup:di:compile, however the problem persists.
Is there another workaround. Someone mentioned adding some code to the ReservationExecution.php class but I don't actually see any code on this topic....
Thank you in advance for any help
Same error here on upgrading from V2.4.3-p2 to 2.4.6-p2 community edition.
Upgrading all composer modules does not help. Error still persists on compile.
Is there any solution for this?
problem solved by installing yireo/magento2-replace-inventory
composer require yireo/magento2-replace-inventory:^4.2.8
Hello @mschauerhe132f ,
The error message:
"Interface 'Magento\InventorySales\Model\ReservationExecutionInterface' not found" indicates that Magento cannot locate the interface ReservationExecutionInterface within the Magento\InventorySales\Model namespace.This can occur if the interface is missing or if there is an issue with the autoloading mechanism.
Verify that the ReservationExecutionInterface interface is defined in the Magento\InventorySales\Model namespace. You can look for this interface in the Magento source code to ensure it exists.
Update all Magento inventory modules to the latest compatible versions with the composer update.
Clear generated, cached, and compiled files under var/
Manually delete the generated/code folder
Enable developer mode or default mode using php bin/magento deploy:mode:set developer
Run bin/magento setup:upgrade before recompiling
At last, remove the vendor folder and run composer install for fresh dependencies.
If you have any questions you can contact us.