Discord Bot Crash & Exit Code Troubleshooting Guide
Last Updated: 2026-09-14•Version: v2.4
Most Discord bot crashes on Pterodactyl are caused by: Exit Code 137 (Out of Memory / RAM limit exceeded), Exit Code 1 (Unhandled Promise Rejection or Syntax Error), Disallowed Intents (Missing developer portal intents), or Exit Code 4004 (Invalid Bot Token). Inspect the Pterodactyl Web Console stdout logs to identify the exact stack trace.
Common Exit Codes & How to Fix Them
1. Exit Code 137: Out of Memory (OOM Killed)
- Symptom: The container panel status changes to
Offline (Crashed)withContainer killed by OOM killerorExit Code 137. - Cause: Your bot attempted to consume more RAM memory than allocated by your container plan. Common triggers include caching large user/guild arrays in memory or memory leaks.
- Fix:
- Inspect memory usage graphs in the Console tab.
- Disable unused gateway cache intents in
discord.js(e.g.,GatewayIntentBits.GuildMembersorGuildPresences). - Upgrade your plan to a higher RAM tier (e.g., from 256 MB to 512 MB or 1 GB) on Paid Discord Hosting.
2. Exit Code 1 / MODULE_NOT_FOUND Error
- Symptom: Console outputs
Error: Cannot find module 'discord.js'orModuleNotFoundError: No module named 'requests'. - Cause: Required library dependencies are missing from
package.jsonorrequirements.txt. - Fix:
- For Node.js: Run
npm install <package-name>in the Pterodactyl console or updatepackage.jsonand restart. - For Python: Add the missing package to
requirements.txtin the Files tab and restart.
- For Node.js: Run
3. Exit Code 4004 / An invalid token was provided
- Symptom: Bot attempts to connect to Discord WebSocket gateway and immediately disconnects.
- Cause: Incorrect, reset, or malformed
BOT_TOKENstring. - Fix:
- Reset your bot token at Discord Developer Portal.
- Open the Startup tab in Pterodactyl panel.
- Update your
BOT_TOKENvariable without extra quotes or spaces.
4. DisallowedIntentsException / Code 4014
- Symptom: Bot crashes with
[DISALLOWED_INTENTS]: Privileged intent provided is not enabled. - Cause: Your code requests privileged intents (Message Content, Server Members, or Presences) that are disabled in the Discord Developer Portal.
- Fix:
- Open Discord Developer Portal.
- Click your Application ➔ Bot tab.
- Scroll down to Privileged Gateway Intents and enable Message Content Intent and Server Members Intent.
How to Enable Automated Crash Restarts in Pterodactyl
VisiHost containers include automated health monitoring:
- If your process crashes due to an unhandled exception, our Pterodactyl daemon automatically restarts your bot within seconds.
- If your bot enters a rapid crash loop (crashing more than 10 times in 60 seconds), the daemon pauses restarts to prevent resource exhaustion.
- Fix the underlying code syntax or token error, then click Start manually in the Console tab.
Related Guides & Resources
- Check RAM and vCPU recommendations in Discord Bot RAM & CPU Requirements.
- Learn deployment steps for discord.js or discord.py.
- Upgrade to dedicated persistent resources starting at ₹10/mo on Paid Discord Bot Hosting.