Discord Bot Keeps Going Offline? Causes and Fixes
If your Discord bot keeps going offline, the cause is usually a crash, a bad token, missing intents, rate limits or low memory. Here is how to find it.
A Discord bot that keeps going offline almost always has one of a few causes: the program crashed, the token is wrong, the host put it to sleep, it ran out of memory, or Discord is limiting it. The console log tells you which one, so start there.
Step 1: read the console
Open the console on your host and look at the last lines before the bot stopped. A crash prints an error and a line number. A login problem prints a clear message. If the log is empty and the bot is gone, the host probably stopped the process.
Common causes and fixes
- Unhandled error. One exception in a command can stop the whole program. Wrap risky code, such as API calls and database queries, in error handling and log the error.
- Invalid or reset token. A stray space, an old token or a reset in the developer portal causes a login failure. Paste the new token again as an environment variable.
- Missing intents. If the bot connects but ignores messages or members, enable the right gateway intents in the developer portal and in your code.
- Out of memory. A growing cache or a leak makes the host stop the bot. Check the memory graph and see our guide on how much RAM a bot needs.
- Rate limits. Sending too many requests too fast gets the bot slowed down or temporarily blocked. Queue messages instead of sending bursts.
- The host sleeps your bot. Free app platforms often stop idle processes. A host built for bots keeps it running. See free vs paid bot hosting.
- Your own computer. A bot on a laptop dies when the laptop sleeps or loses Wi-Fi.
Make crashes less painful
- Log every error with a time stamp.
- Catch errors per command so one failure does not kill the bot.
- Keep a copy of the last working code to roll back to.
- Use a host that restarts the bot after a crash.
- Test changes on a separate test bot, not the one your members use.
When it is the host
If the code is fine and the bot still disappears, the host may be limiting resources or sleeping the process. Our Discord bot hosting keeps bots running with a full console on Pterodactyl, supports Python, Node.js, Java and Go, and our team answers at support@bracknodes.in. The Discord rate limit documentation explains the limits your bot must respect.
Frequently asked questions
Why does my Discord bot go offline by itself?
The usual causes are an unhandled error that crashes the program, an invalid token, running out of memory, rate limiting, or a host that stops idle processes.
How do I find out why my bot stopped?
Read the last lines in the host console before it stopped. A crash prints an error, and a login problem prints a clear message.
Can a wrong token make a bot go offline?
Yes. A reset or mistyped token causes a login error and the bot will not connect.
Does low RAM make a bot go offline?
Yes. If memory use grows past the plan limit, the host can stop the process. Reduce caches or move to a larger plan.
How can I make my bot restart automatically?
Use a host that restarts the process after a crash, and catch errors in your code so one failed command does not stop the bot.