PHP Fatal error:  Uncaught Error: Call to undefined method GuzzleHttp\Utils::chooseHandler() – Drush

man in white shirt using macbook pro

In a local Drupal 9 site, set up using DDEV from a site hosted on Acquia, every time I need to run a drush command I get the following error:

PHP Fatal error:  Uncaught Error: Call to undefined method GuzzleHttp\Utils::chooseHandler() in /var/www/html/vendor/guzzlehttp/guzzle/src/functions.php:61
Stack trace:
#0 /var/www/html/web/vendor/guzzlehttp/guzzle/src/HandlerStack.php(42): GuzzleHttp\choose_handler()
#1 [internal function]: GuzzleHttp\HandlerStack::create()

The workaround

We need to install Drush in the project folder. running this command: composer require --dev drush/drush

And then, we can execute the local drush command from the project instead of the global one, like this:

vendor/drush/drush/drush cim --yes

Posted

in

, ,

by

Tags: