Troubleshooting
Invalid token
Your Discord bot can't log in because its token is wrong, missing or has been reset.
You’ll see one of these in the console:
Error [TokenInvalid]: An invalid token was provided.
discord.errors.LoginFailure: Improper token has been passed.
Discord refused to log your bot in. The token your code sent isn’t a valid, current one.
Fix it
- Go to the Discord Developer Portal, open your application and go to Bot.
- Click Reset Token and copy the new one.
- On Smile Hosting, open your server’s Files tab and paste it into wherever your code reads it - usually
.env(TOKEN=...) orconfig.json. Click Save. - Press Restart on the Console tab.
Common causes
- The token was reset. Discord resets tokens itself if it spots one posted publicly, for example in a GitHub repository. Your old token stops working the moment that happens.
- Extra characters. A space, a line break, or quote marks copied along with the token.
- The wrong thing was copied. The Application ID and Public Key on the General Information page are not the token - it’s only on the Bot page.
- The file isn’t being read. If you use
.env, check the file is named exactly.envand your code loads it (require('dotenv').config()orload_dotenv()).
DangerNever share your token with anyone - including us. If you think it’s leaked, reset it straight away.