Drush was reporting that a command was not found.
For example, running the drush command for a config export:
was resulting in an error: “Command cex was not found.”
Running debug gave some additional information, which included “Unable to connect to database with message: SQLSTATE[HY000]  MySQL server has gone away.”
To solve this I increased the max_allowed_packet size in the mysql .cnf file.
My local valet setup uses mysql running via homebrew. So for me the file was located in:
If you can’t find yours, I had success running:
mysql —help | grep cnf
and restarting mysql
brew services restart email@example.com
If you aren’t running the same version of mysql through homebrew, you can find your brew version using:
brew services list