Bot does not start or crashes
What the overview and the console say about a bot that does not start, ends or crashes, and the most common reasons: a missing token, the wrong start file, dependencies and too little memory.
On your bot server's Overview, the App section says what it last started with. If your program ended without anyone stopping the server, it says when and with which code underneath, and the last lines it printed before. The whole output is in the Console tab; lines from GoodFlare start with [GoodFlare] there.
When a program crashes, the server starts it again by itself. If it crashes again shortly after, the server stays off so it does not restart endlessly. Under Notifications you choose whether a crash sends you an email, a Discord message or a push message.
The token is missing or wrong
Messages like An invalid token was provided, TokenInvalid, 401 Unauthorized or Unauthorized at sign-in mean your program has no bot token or a wrong one.
- Is the token in the Environment tab under exactly the name your code reads? Case matters; names there are in capitals.
- Did you restart after saving? Variables count from the next start.
- Is the token still valid? If it was regenerated at the provider, replace it with Replace.
- Discord reports
Used disallowed intentswhen your bot uses intents that are not switched on in the Discord developer portal.
No start file, or the wrong one
No start file found means nothing was detected under Automatic, usually because there is no code yet or it sits in a subfolder. Check in the Files tab where your files are, and choose the right file under App at Start command, or enter an Own start line. Cannot find module '/home/container/index.js' or can't open file 'main.py' means the chosen file does not exist.
Dependencies
- The dependencies could not be installed: the reason is on the overview and in the console above that line. Often the package-lock.json does not match the package.json (
npm cithen stops): create it again on your side or delete it, and the server takesnpm install. Cannot find module 'discord.js'orModuleNotFoundError: No module named 'discord': the package is missing from package.json or requirements.txt, or Install dependencies at start is off.- Packages compiled during installation sometimes need a particular version of the runtime. Choose another version under App.
Too little memory
If your program ends with code 137, or the console says JavaScript heap out of memory or MemoryError, the memory was full. How much your bot needs is in the Performance tab. More memory comes with Change plan.
The code is not updated
- If Last fetch says “not updated” because files changed here were also changed in the repository, you changed a file on the server that has a new version in the repository. Undo the change on the server or put it into the repository.
- Failed: the console names the reason, such as a wrong address, a wrong branch, or a missing or expired access token for a private repository.
- With Update at every start off, fetch the new code with Update and restart on the overview.
Webhooks do not arrive
Your program must listen on 0.0.0.0 on the port from the environment variable PORT, not on localhost or a port written into the code. The public address is under App at Port.
Related articles
- Bots & Apps: code, environment variables and startHow your Discord, Telegram or Twitch bot or small app gets onto the server: from a Git repository or by upload, with tokens in the environment variables and a start command the portal usually finds by itself.
- Console: commands, log and powerFollow your game server's log live, send commands, start and stop the server, and share a log with others.
- Notifications by email, push, Discord and WhatsAppChoose what you hear about and how: a crash, a failed backup, a renewal. For the whole account and for each game server on its own.
Need help?
If this guide does not answer your question, write to us. Usually within 24 hours.