From a Stack Exchange question:

'css-js' cache is not a valid cache type

This message is confusing to new users who do not understand the Drush bootstrap process. Perhaps it could be enhanced to include a message stating that a site must be selected if the user enters the specific name of a valid cache that is not available at the current bootstrap level.

Files: 
CommentFileSizeAuthor
#2 cache_clear_error_msg.patch2.4 KBgreg.1.anderson

Comments

Category:bug» feature

Eh, I guess this is more of a feature request.

Status:Active» Needs review
StatusFileSize
new2.4 KB

Here's a simple adjustment to improve the error message when there is no bootstrapped site.

$ drush cc djlae
'djlae' cache is not a valid cache type. There may be more cache     [error]
types available if you select a working Drupal site.
$ drush cc css-js
'css-js' cache requires a working Drupal site to operate on. Use the [error]
--root and --uri options, or a site @alias, or cd to a directory
containing a Drupal settings.php file.
$ drush @site cc aslje
'aslje' cache is not a valid cache type.                             [error]

A better error message is good. So does the new code give a sensible error message when the user mistypes 'drush cc druAsh` in his homedir?. That should not start giving any advice about Drupal.

It says this:

$ drush cc druAsh
'druAsh' cache is not a valid cache type. There may be more cache     [error]
types available if you select a working Drupal site.

There's no good way to tell the difference between a typo and a type that might be available via a hook, so the message says that there "may be more" cache types. If you prefer, the message above could be removed, and left in its current short form unless a user exactly types a cache type that is known to be available when a Drupal site is bootstrapped.

Status:Needs review» Reviewed & tested by the community

That error looks perfect. thanks.

Status:Reviewed & tested by the community» Fixed

Committed to 8.x-6.x and 7.x-5.x.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.