Are you by any chance using the source sdk version of hammer? These days, you want to use the hammer.exe found in the common/team fortress 2/bin folder
If this is your first time logging in after the migration (Feb 8, 2022), you must reset your password to log in. Follow this guide if you're having trouble