There are times when I run drush cc css-js and I get the following error:

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

Does anyone know why this may happen?


  • 1
    You're probably running it outside of a Drupal root, and without specifying a @site to run it on. So Drush tries to clear its internal cache, in which there's no 'css-js' type. To test: cd /path/to/drupal/root; drush cc css-js; cd ..; drush cc css-js. The first cc call should work, but not the second – Clive Mar 27 '13 at 16:47
  • Clive's answer above is correct. I added an issue to the Drush queue for this: drupal.org/node/1954552 – greg_1_anderson Mar 27 '13 at 17:16
  • 1
    Please provide more information here. What is the output of drush status, and what happens when you run with --debug? – greg_1_anderson Apr 4 '13 at 15:21

The latest dev releases of Drush (both 8.x-6.x and 7.x-5.x) now provide a better error message when attempting to select a specific cache type (e.g. css-js) without first selecting a working Drupal site. c.f. http://drupal.org/node/1954552

Note also that when selecting a Drupal site, cd /path/to/drupal/root only works if settings.php is stored in a directory called "default". Otherwise, you will need to instead cd /path/to/drupal/root/sites/mysite.com before using drush cc css-js. You can also use the --root and --uri parameters, e.g. drush --root=/path/to/drupal/root --uri=http://mysite.com cc css-js

  • Thank you for your answer. I took another look at my alias for clearing the cache and I am passing the root. drush -r /srv/examplesite/htdocs/ cc css-js and my settings.php file is in the default folder. – Paul Sheldrake Apr 3 '13 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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