Unable to run "drush uli" - Drupal 8

Submitted by John on Tue, 12/01/2020 - 16:05

I spent an embarrassing amount of time hung up on this. So I'm writing this  post now, to save anyone else the trouble. I was trying to log into a local, lando-based Drupal site, but I kept getting this error: 


$ lando drush uli

Error: Class 'Drupal\user\Entity\User' not found in Drush\User\User8->load_by_uid() (line 26 of /app/vendor/drush/drush/lib/Drush/User/User8.php) #0 /app/vendor/drush/drush/lib/Drush/User/UserList.php(103): Drush\User\User8->load_by_uid('1')    [error]
#1 /app/vendor/drush/drush/lib/Drush/User/UserList.php(15): Drush\User\UserList::getFromParameters(Array)
#2 /app/vendor/drush/drush/commands/user/user.drush.inc(409): Drush\User\UserList->__construct(1)
#3 /app/vendor/drush/drush/includes/command.inc(422): drush_user_login()
#4 /app/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#5 /app/vendor/drush/drush/includes/command.inc(199): drush_command()
#6 /app/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#7 /app/vendor/drush/drush/includes/preflight.inc(67): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#8 /app/vendor/drush/drush/drush.php(12): drush_main()
#9 {main}.
 

I came across this issue,  on the drush project, but it was closed without providing any answers, and I couldn't find the question on the Drupal stack exchange. 

Turns out, I was trying to run the command on a site with an empty database... This obviously would never work. I had dropped the database earlier, and attempted to import a fresh dump, but it seems that step never started.