Connection Issues
Bot fails to connect with 'Invalid Token' error
Bot fails to connect with 'Invalid Token' error
- Token is incorrect or expired
- Token has extra whitespace or characters
- Using user token instead of bot token
- Verify your token in the Discord Developer Portal
- Regenerate the token if necessary
- Ensure no extra spaces or quotes in your token string:
- Make sure you’re using the bot token, not the client secret
WebSocket connection failures or frequent disconnects
WebSocket connection failures or frequent disconnects
- Bot connects then immediately disconnects
- Repeated reconnection attempts
- Gateway timeout errors
- Network connectivity issues
- Firewall blocking WebSocket connections
- Invalid proxy configuration
- Rate limiting from Discord
- Check your internet connection and firewall settings
- Ensure WebSocket connections (wss://) are allowed
- If using a proxy, configure it properly:
- Avoid multiple rapid connection attempts (respect rate limits)
- Enable debug logging to see detailed connection info:
Bot goes offline randomly
Bot goes offline randomly
- Bot appears offline in Discord without warning
- No error messages in logs
- JVM still running
- Thread pool exhaustion
- Unhandled exceptions in event listeners
- Memory leaks
- Network issues
- Add proper error handling in event listeners:
- Configure custom thread pool if needed:
- Monitor memory usage and optimize caching
- Implement reconnect listeners to log disconnections
Intent and Cache Issues
Missing message content (empty messages)
Missing message content (empty messages)
event.getMessage().getContentRaw()returns empty string- Message content is blank even though message exists
MESSAGE_CONTENT privileged intentSolutions:- Enable the intent in Discord Developer Portal:
- Go to your application
- Navigate to “Bot” section
- Enable “Message Content Intent”
- Add the intent to your code:
- For verified bots with 100+ servers, you may need to apply for intent approval
Members not showing up (empty member cache)
Members not showing up (empty member cache)
guild.getMembers()returns empty or incomplete listguild.getMemberById()returns null for existing members- Member count shows as 0 or 1
- Missing
GUILD_MEMBERSintent - Member cache disabled
- Member chunking not enabled
- Enable required intent and configure caching:
- For large bots, use selective caching:
- Fetch members on-demand if caching is disabled:
Presence updates not received
Presence updates not received
onUserUpdateOnlineStatusnot firing- User activities not updating
GUILD_PRESENCES intentSolutions:- Enable the privileged intent in Developer Portal
- Add to your bot configuration:
Command and Interaction Issues
Slash commands not appearing in Discord
Slash commands not appearing in Discord
- Commands registered but not visible in Discord
/menu doesn’t show your bot’s commands
- Commands not registered with Discord
- Using guild commands but checking different guild
- Caching delay for global commands
- Ensure commands are registered:
- For testing, use guild-specific commands (instant update):
- Global commands can take up to 1 hour to propagate
- Check bot has
applications.commandsscope
Interaction timeout: 'Unknown Interaction'
Interaction timeout: 'Unknown Interaction'
- Always acknowledge interactions immediately:
- Use
deferReply(true)for ephemeral responses - For very long operations, send immediate response and update later
Button or menu interactions not working
Button or menu interactions not working
Audio Issues
Bot joins voice but no audio plays
Bot joins voice but no audio plays
- Bot appears in voice channel
- No sound is heard
- No errors in console
- Missing audio implementation (DAVE Protocol)
- Audio send system not configured
- Bot muted or volume at 0
- Add DAVE Protocol implementation dependency:
- Check if bot is server muted in Discord
- Verify audio sending is working:
- See Making a Music Bot guide
Audio stuttering or choppy playback
Audio stuttering or choppy playback
- Audio plays but skips or stutters
- Robotic or distorted sound
- GC pauses interrupting audio thread
- CPU overload
- Network issues
- Use
udpqueueto avoid GC pauses:
- Optimize JVM garbage collection settings
- Reduce bot workload during playback
- Use Lavalink for distributed audio processing
Cannot join voice channel
Cannot join voice channel
- Check bot has
VOICE_CONNECTpermission:
- Verify role permissions in Discord server settings
- Check channel-specific permission overrides
Performance Issues
High memory usage
High memory usage
- Aggressive caching
- Memory leaks in event handlers
- Large message/embed caching
- Use lighter cache configuration:
- Disable unnecessary caches:
- Monitor heap usage and tune JVM parameters
- Use weak references for temporary data
Slow response times or rate limit errors
Slow response times or rate limit errors
- Commands take long to respond
RateLimitedExceptionerrors- 429 HTTP responses
- Hitting Discord API rate limits
- Too many requests in short time
- Inefficient request patterns
- JDA handles rate limits automatically - don’t override
- Batch requests when possible:
- Use efficient caching to reduce API calls
- Implement request queuing for burst operations
- Review logs for rate limit warnings
Build and Dependency Issues
NoClassDefFoundError or ClassNotFoundException
NoClassDefFoundError or ClassNotFoundException
- Add SLF4J implementation:
- If using Maven, ensure all dependencies are included
- For shaded JARs, verify dependency inclusion
Dependency conflicts or version mismatches
Dependency conflicts or version mismatches
- Build fails with dependency resolution errors
- Runtime errors with conflicting classes
- Use dependency management:
- Check for conflicting transitive dependencies
- Update all JDA-related libraries together
Build fails with Java version errors
Build fails with Java version errors
- Ensure Java 8+ is installed:
java -version - Set Gradle/Maven to use Java 8+:
Getting More Help
If your issue isn’t listed here:- Search existing issues: GitHub Issues
- Check the FAQ: JDA FAQ
- Ask on Discord: JDA Discord Server
- Review documentation: JDA Wiki