We are using Magento Cloud Enterprise and using the Magento Version 2.2.

We are not able to delete the generated/ folder, has anybody else faced this issue before?

From comments:
We tried deleting inside generated, yet we couldn't delete the contents, we are getting a "Read-only Filesystem" error.

  • Can you please let us know, what method you are following to delete it e.g. manually or CLI and what message you are getting while deleting it?
    – Tejas Vyas
    Jan 4, 2018 at 10:03
  • Magento Cloud uses a read only file system. Are you trying to deleted the generated folder itself (should not be possible)? Did you try deleting stuff inside generated/* (should be possible)?
    – 7ochem
    Jan 4, 2018 at 10:04
  • As @7ochem suggesting, try deleting the contents inside. Jan 4, 2018 at 10:07
  • Thank you Guys, we tried deleting it inside generated , yet we couldn't delete the contents, we are getting , 'Read-only Filesystem' Error Jan 4, 2018 at 10:47
  • 1
    Aha, that's right. The generated folder is filled (generated) during the build process and is part of the write protected files. You should trigger a new build to re-generate the generated/ folder
    – 7ochem
    Jan 4, 2018 at 12:35

1 Answer 1


Magento Cloud Enterprise files are locked within a read-only filesystem, with the exception of several files that should be writable by Magento 2 at runtime (logs, error reports, caches [if not in Redis]).

Also the generated/ folder and the pub/static/ folder and their content are fully write protected. Your website should run in production mode and all generated code and assets should not change in between builds.

The only way to re-generate (and thus clear) what's in the generated/ folder is to trigger a new build which will compile the files (running setup:di:compile).

  • We actually, tried this, but it seems not to be working :( Jan 8, 2018 at 10:23
  • How did you trigger it to build?
    – 7ochem
    Jan 8, 2018 at 14:10
  • Hi @RichardValsalan Did you get any solutions?
    – Rajan Soni
    Jan 17, 2020 at 10:42
  • Hi @RajanSoni ya I got a fix for ths... I raise a ticket in Magento cloud and they gave permission to my user account to delete and regenerate when required Jul 23, 2020 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.