magento2: Path "/var/www/html/var" cannot be used with directory "/var/www/html/var"

I figured out it was a permission issue after a bunch of Googling, but I mean come on. This stuff should be fixed.

Preconditions (*)

  1. Magento 2.3.3

Steps to reproduce (*)

  1. Install Magento 2.3.3
  2. Have permission problems
  3. Do something

Expected result (*)

Useful error message about what directory is not writeable.

Actual result (*)

Useless error message. The problem is here:

$ grep "cannot be used with directory" -R *
vendor/magento/framework/Filesystem/Directory/PathValidator.php:                    'Path "%1" cannot be used with directory "%2"',

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Really? Do you find this error message to give adequate feedback to a developer on what the problem is?

No wonder Magento is pure nightmare to work with when you leave stupid issues like this in core all over the place.

I recommend reading this: https://uxplanet.org/how-to-write-good-error-messages-858e4551cd4

Hello @Zyles

Please check your r/w permission.

I forgot exactly which directory it was. It is a permission error and I already fixed it.

The problem is here:

$ grep "cannot be used with directory" -R *
vendor/magento/framework/Filesystem/Directory/PathValidator.php:                    'Path "%1" cannot be used with directory "%2"',

Please update the message to something meaningful.

Maybe:

‘Can’t write to directory “%1”. Please check web server permissions.’

Or similar.