Solved: Failed to Open Stream Error While Compiling PluginListGenerator.php in Magento 2.4.1


Magento 2 is a preferable choice for E-commerce stores serving the global customer base, owing to the flexibility and customization options.

Magento releases upgraded versions to improve the store performance and it is highly recommended to upgrade to the latest Magento 2 version.

However, sometimes the developers face errors while migrating, upgrading, customizing or performing any operations on the Magento 2 store.

One of them is failed to open stream error while compiling PluginListGenerator.php in Magento 2.4.1 that says,

file_put_contents(C:/xampp/htdocs/Yash/mag241sample/generated/metadata/primary|global|plugin-list.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Yash\mag241sample\vendor\magento\framework\Interception\PluginListGenerator.php on line 414

You may face this error while running the command “bin/magento setup:di:compile” in Magento 2.4.1 using XAMPP.

Error while compile

This error may also occur after upgrading your Magento 2 from an older version to Magento 2.4.1.

Check the solution for the same below:

Solution for Failed to Open Stream Error While Compiling PluginListGenerator.php in Magento 2.4.1

  1. Open PluginListGenerator.php file located at vendor/magento/framework/Interception.
  2. Go to line 414 or find the word “scopePriorityScheme” in PluginListGenerator.php file.
  3. Replace the line
    with below:
  4. Save the PluginListGenerator.php file.

Now your “bin/magento setup:di:compile” command will run successfully without any error.

That’s it!

If you have any question regarding this error or its solution, feel free to mention them in the Comments section below.

I’m here to help you out.

Do share the solution with Magento Community via social media.

Thank You.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

(based on 11 Reviews)

Yash is a Magento Developer at Meetanshi. He loves playing computer games and watching action movies. For brain exercise, he likes to play Chess.

Leave a reply:

Your email address will not be published.