Discord Bot Troubleshooting
Use this guide when your Discord bot misbehaves. Work through the sections in order and gather logs before contacting support.
Connection & Authentication
Section titled “Connection & Authentication”| Symptom | Possible Cause | Solution |
|---|---|---|
| Console stuck on “Connecting…” | Invalid token, missing intents, Discord outage | Regenerate token, ensure intents are approved, check discordstatus.com |
| Bot exits immediately (code 0) | Missing env vars, wrong entry file path | Verify DISCORD_TOKEN exists, update start command |
| Slash commands not showing | Commands not registered, wrong app ID | Run registration script with production token, wait for propagation |
Performance Issues
Section titled “Performance Issues”Memory Problems
Section titled “Memory Problems”-
Use heap snapshots to identify memory leaks
-
Disable large caches or move them to Redis
-
Reduce shard count if memory per shard is high
-
Upgrade plan if memory exceeds 75% after optimizations
High CPU Usage
Section titled “High CPU Usage”-
Profile your code for CPU-intensive operations
-
Offload audio transcoding to dedicated workers
-
Reduce sync operations in favor of async patterns
-
Scale to Premium for CPU-heavy workloads
Slow Commands
Section titled “Slow Commands”-
Profile database and HTTP calls for bottlenecks
-
Enable caching for frequently accessed data
-
Use deferred replies for operations taking > 3 seconds
-
Enforce timeouts on external API calls
Voice & Audio Issues
Section titled “Voice & Audio Issues”-
Request FFmpeg and libsodium from support if not installed
-
Verify bot permissions — needs
CONNECTandSPEAK -
Check voice region matches your audience
-
Consider Lavalink for centralized audio mixing
| Problem | Solution |
|---|---|
| No audio output | Confirm FFmpeg installed, check bot permissions |
| Audio stuttering | Reduce concurrent voice connections, upgrade CPU |
| Voice channel errors | Verify bot has permission to join/speak |
Dependency Problems
Section titled “Dependency Problems”Node.js Issues
Section titled “Node.js Issues”| Problem | Solution |
|---|---|
node-gyp failures | Pre-build binaries locally and upload |
| Module not found | Run npm install in panel console |
| Outdated Discord.js | Update to avoid API incompatibilities |
Python Issues
Section titled “Python Issues”| Problem | Solution |
|---|---|
pip install errors | Use pip wheel to pre-compile packages |
| Missing system libraries | Request libffi, libxml2, etc. via support |
| Wheel build failures | Pre-build locally and upload |
Rate Limits & API Errors
Section titled “Rate Limits & API Errors”-
Implement request queuing with exponential backoff
-
Respect
X-RateLimitheaders from Discord -
Cache API results to reduce redundant calls
-
Use bulk operations where available
-
Log 429 responses with route info to identify hotspots
Watchdog Restart Loops
Section titled “Watchdog Restart Loops”-
Check console for exit code and stack trace
-
Disable problematic features via environment variables
-
Test fix in staging before promoting to production
-
Roll back using panel backups if urgent
Common Exit Codes
Section titled “Common Exit Codes”| Code | Meaning | Action |
|---|---|---|
| 0 | Clean exit (possibly early) | Check for missing token or config |
| 1 | General error | Review stack trace in logs |
| 137 | Out of memory (OOM killed) | Optimize memory or upgrade plan |
Database Issues
Section titled “Database Issues”| Problem | Solution |
|---|---|
| MySQL connection refused | Verify credentials and host/port in env vars |
| SQLite corruption | Restore from backup, reduce unclean shutdowns |
| Migration failures | Run migrations locally first, wrap in try/catch |
Quick Diagnostic Checklist
Section titled “Quick Diagnostic Checklist”Before contacting support, verify:
- Token is valid and not expired
- Required intents are enabled in Discord Dev Portal
- Environment variables are set correctly
- Dependencies are installed (
npm install/pip install) - Entry file path matches start command
- No rate limit errors in logs
- Checked discordstatus.com for outages
When to Contact Support
Section titled “When to Contact Support”Gather this information before opening a ticket:
-
Timeline — When did the issue start?
-
Recent changes — Deployments, config updates, library upgrades
-
Console logs — Error messages and stack traces
-
Guild/user IDs — Affected guilds or users
-
Steps to reproduce — If known
Request Support For
Section titled “Request Support For”- System package installation (FFmpeg, libsodium, codecs)
- Panel/API access for automation
- Persistent hardware issues
- Custom plan requirements (GPU, multi-region)
Incident Response Template
Section titled “Incident Response Template”Incident: <Short description>Detected: <Timestamp + monitoring source>Impact: <Commands failing / downtime length / affected guilds>Immediate Action: <Scale, rollback, disable feature>Root Cause: <Once found>Follow-up Tasks: <Testing, automation, docs>Helpful Links
Section titled “Helpful Links”Need Help?
Section titled “Need Help?”- Support: support@mambahost.com
- Discord: Join our server