0

I am getting the following error trying to run Drush on Win10, WSL2, and DDev. I can run other Drush commands, but not all of them.

How do I fix it?

Command self-update was not found. Drush was unable to query the database. 
As a result, many commands are unavailable. 
Re-run your command with --debug to see relevant log messages.

Below is the output when I run the command with the debug flag...

username@DESKTOP-4JKF77A:~/workspace/drupal8Dev$ drush self-update --debug
[preflight] Config paths: /home/username/workspace/drupal8Dev/vendor/drush/drush/drush.yml
[preflight] Alias paths: /home/username/workspace/drupal8Dev/web/drush/sites,/home/username/workspace/drupal8Dev/drush/sites
[preflight] Commandfile search paths: /home/username/workspace/drupal8Dev/vendor/drush/drush/src
[debug] Bootstrap further to find self-update [0.03 sec, 7.94 MB]
[debug] Trying to bootstrap as far as we can [0.03 sec, 7.94 MB]
[debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.03 sec, 7.94 MB]
[debug] Change working directory to /home/username/workspace/drupal8Dev/web [0.03 sec, 7.94 MB]
[debug] Initialized Drupal 8.9.7 root directory at /home/username/workspace/drupal8Dev/web [0.03 sec, 8.14 MB]
[debug] Drush bootstrap phase: bootstrapDrupalSite() [0.03 sec, 8.43 MB]
[debug] Initialized Drupal site default at sites/default [0.04 sec, 8.67 MB]
[debug] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.04 sec, 8.66 MB]
[debug] Add service modifier [0.04 sec, 8.79 MB]
[debug] Unable to connect to database. More information may be available by running `drush status`. 
This may occur when Drush is trying to bootstrap a site that has not been installed or does not have a configured database.
In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line.
See `drush topic docs-aliases` for details. [0.04 sec, 8.84 MB]
[debug] Bootstrap phase bootstrapDrupalDatabase() failed to validate; continuing at bootstrapDrupalConfiguration() [0.04 sec, 8.84 MB]
[debug] Done with bootstrap max in Application::bootstrapAndFind(): trying to find self-update again. [0.04 sec, 8.84 MB]

In Application.php line 239:

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command self-update was not found. Drush was unable to query the database. As a result, many commands are 
unavailable. Re-run your command with --debug to see relevant log messages.


Exception trace:
at /home/username/workspace/drupal8Dev/vendor/drush/drush/src/Application.php:239
Drush\Application->bootstrapAndFind() at /home/username/workspace/drupal8Dev/vendor/drush/drush/src/Application.php:192
Drush\Application->find() at /home/username/workspace/drupal8Dev/vendor/symfony/console/Application.php:236
Symfony\Component\Console\Application->doRun() at /home/username/workspace/drupal8Dev/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /home/username/workspace/drupal8Dev/vendor/drush/drush/src/Runtime/Runtime.php:118
Drush\Runtime\Runtime->doRun() at /home/username/workspace/drupal8Dev/vendor/drush/drush/src/Runtime/Runtime.php:49
Drush\Runtime\Runtime->run() at /home/username/workspace/drupal8Dev/vendor/drush/drush/drush.php:72
require() at /home/username/workspace/drupal8Dev/vendor/drush/drush/drush:4
7
  • You should probably ask this question on Stack Overflow, having it tagged ddev. The maintainers normally react pretty fast there.
    – leymannx
    Oct 28, 2020 at 14:33
  • How exactly did you run the command? ddev exec 'drush COMMAND'? Or with the new ddev drush COMMAND?
    – leymannx
    Oct 28, 2020 at 14:35
  • And did you export IS_DDEV_PROJECT=true? At least this needed to happen on Mac to run Drush Launcher and be able to simply drush COMMAND from outside as usual.
    – leymannx
    Oct 28, 2020 at 14:37
  • Looks like the database connection is not set right in sites/default/settings.php Does the site function at all?
    – C.A. Vuyk
    Oct 28, 2020 at 16:17
  • 1
    @leymannx, I think that was my issue. I wasn't adding 'ddev exec' before the drush command.
    – jbreslow
    Oct 28, 2020 at 17:11

0

Your Answer

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

Browse other questions tagged or ask your own question.