Ever encountered Drush error while running Drush commands in your local against sites hosted in Acquia? Here is a solution.
Drush command:
drush @example.dev status
Drush version:
Drush Commandline Tool 9.6.0
Drush error:
ArgumentCountError: Too few arguments to function Drush\Sql\SqlBase::__construct(), 1 passed and exactly 2 expected in Drush\Sql\SqlBase->__construct() (line 42 of /mnt/www/html/vendor/drush/drush/src/Sql/SqlBase.php).
ArgumentCountError: Too few arguments to function Drush\Sql\SqlBase::__construct(), 1 passed and exactly 2 expected in /mnt/www/html/vendor/drush/drush/src/Sql/SqlBase.php on line 42 #0 [internal function]: Drush\Sql\SqlBase->__construct(Array)
#1 /usr/local/drush8/vendor/drush/drush/includes/drush.inc(117): ReflectionClass->newInstanceArgs(Array)
#2 /usr/local/drush8/vendor/drush/drush/commands/sql/sql.drush.inc(532): drush_get_class('Drush\\Sql\\Sql', Array, Array)
#3 /usr/local/drush8/vendor/drush/drush/commands/sql/sql.drush.inc(549): drush_sql_get_class(Array)
#4 /usr/local/drush8/vendor/drush/drush/includes/environment.inc(389): drush_sql_get_class()
#5 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php(462): drush_valid_db_credentials()
#6 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/DrupalBoot8.php(109): Drush\Boot\DrupalBoot->bootstrap_drupal_database_validate()
#7 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(430): Drush\Boot\DrupalBoot8->bootstrap_drupal_database_validate()
#8 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(507): drush_bootstrap_validate(4)
#9 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(456): drush_bootstrap_max()
#10 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(59): drush_bootstrap_to_phase(-2)
#11 /usr/local/drush8/vendor/drush/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 /usr/local/drush8/vendor/drush/drush/drush.php(12): drush_main()
#13 {main}
Drush command terminated abnormally due to an unrecoverable error. [error]
Fix:
paths:
Drush command:
drush @example.dev status
Drush version:
Drush Commandline Tool 9.6.0
Drush error:
ArgumentCountError: Too few arguments to function Drush\Sql\SqlBase::__construct(), 1 passed and exactly 2 expected in Drush\Sql\SqlBase->__construct() (line 42 of /mnt/www/html/vendor/drush/drush/src/Sql/SqlBase.php).
ArgumentCountError: Too few arguments to function Drush\Sql\SqlBase::__construct(), 1 passed and exactly 2 expected in /mnt/www/html/vendor/drush/drush/src/Sql/SqlBase.php on line 42 #0 [internal function]: Drush\Sql\SqlBase->__construct(Array)
#1 /usr/local/drush8/vendor/drush/drush/includes/drush.inc(117): ReflectionClass->newInstanceArgs(Array)
#2 /usr/local/drush8/vendor/drush/drush/commands/sql/sql.drush.inc(532): drush_get_class('Drush\\Sql\\Sql', Array, Array)
#3 /usr/local/drush8/vendor/drush/drush/commands/sql/sql.drush.inc(549): drush_sql_get_class(Array)
#4 /usr/local/drush8/vendor/drush/drush/includes/environment.inc(389): drush_sql_get_class()
#5 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php(462): drush_valid_db_credentials()
#6 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/DrupalBoot8.php(109): Drush\Boot\DrupalBoot->bootstrap_drupal_database_validate()
#7 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(430): Drush\Boot\DrupalBoot8->bootstrap_drupal_database_validate()
#8 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(507): drush_bootstrap_validate(4)
#9 /usr/local/drush8/vendor/drush/drush/includes/bootstrap.inc(456): drush_bootstrap_max()
#10 /usr/local/drush8/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(59): drush_bootstrap_to_phase(-2)
#11 /usr/local/drush8/vendor/drush/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 /usr/local/drush8/vendor/drush/drush/drush.php(12): drush_main()
#13 {main}
Drush command terminated abnormally due to an unrecoverable error. [error]
Fix:
- Go to your /sites containing *.site.yml files. In my case /home/sastha/sites
- vi example.site.yml
- Check "paths:" variable
- If other aliases are running fine, then set same for your problematic alias
- In my case, changed below from
drush-script: drush
TO
paths:
drush-script: drush9