Error codes
When the WebSocket connection closes with an error code, the application logs it to the console. Below are the error codes you may encounter and how to resolve them.Code 4001: API token is missing
Code 4001: API token is missing
Cause: The Solution:
token field in your config.js file is empty or not set.Console output:- Open your
config.jsfile - Verify the
tokenfield contains your API token - If empty, generate a new token using the
/generatetokencommand in Discord - Save the file and restart the application
Code 4002: API token is invalid
Code 4002: API token is invalid
Cause: The token you provided is malformed or does not match the expected format.Console output:Solution:
- Open your
config.jsfile - Check that you copied the entire token without extra spaces or characters
- Generate a fresh token using
/generatetokenin Discord - Replace the token in
config.js - Save and restart the application
Code 4003: API token already in-use
Code 4003: API token already in-use
Cause: Another instance of the webhook client is already connected using the same API token.Console output:Solution:
- Option 1: Close the other running instance of the webhook client
- Option 2: Generate a new API token for this instance using
/generatetoken - Option 3: If you set
reconnectOnDuplicateConnection: true, the client will attempt to reconnect and force-disconnect the other instance
By default, the application does not reconnect on duplicate connection errors (index.js:136).
Code 4004: API token has been deleted
Code 4004: API token has been deleted
Cause: The API token you’re using has been deleted from Sol’s Stat Tracker.Console output:Solution:
- Generate a new API token using the
/generatetokencommand in Discord - Update the
tokenfield in yourconfig.jsfile - Save and restart the application
Code 1006 or other codes: Unexpected disconnection
Code 1006 or other codes: Unexpected disconnection
Cause: Network issues, server maintenance, or other temporary problems.Console output:Solution:
The application automatically handles these errors with exponential backoff reconnection:If reconnection continues to fail:
- First retry after 31 seconds
- Each subsequent retry doubles the interval (62s, 124s, etc.)
- Maximum retry interval is 120 seconds (configurable via
maxReconnectInterval)
No action is required. The client will automatically reconnect when the connection is restored (index.js:138-151).
- Check your internet connection
- Verify the gateway URL is correct in
config.js - Check if Sol’s Stat Tracker service is experiencing downtime
Webhook errors
Webhook client error
Webhook client error
Cause: Issues with the Discord webhook, such as an invalid webhook URL or the webhook being deleted.Console output:Solution:
- Verify the webhook still exists in your Discord server
- If deleted, create a new webhook and update
webhookURLinconfig.js - Ensure you copied the complete webhook URL including the token
- Check that the webhook URL format is:
https://discord.com/api/webhooks/ID/TOKEN
Webhook errors are handled by the Discord.js library (index.js:20-22).
WS client message error
WS client message error
Cause: The WebSocket received malformed data that couldn’t be parsed as JSON.Console output:Solution:
This is typically a server-side issue. The application will:
- Log the error to the console
- Continue running and processing subsequent messages
- Not require any action from you
Message parsing errors are caught and logged without terminating the connection (index.js:76-78).
Invalid action received
Invalid action received
Cause: The WebSocket received a message with an unrecognized Solution:
This usually indicates:
action field.Console output:- A new action type was added to the server that your client version doesn’t support
- The server sent corrupted data
- Check for updates to Sol’s Stat Tracker Webhook
- Download and install the latest release if available
- If the issue persists, report it to the developer
The application continues running after logging invalid actions (index.js:72-74).
Connection issues
Application won't start
Application won't start
Symptoms: The application closes immediately or shows a Node.js error.Common causes and solutions:1. Node.js not installed
- Download and install Node.js
- Restart your computer after installation
- Try running
run.batagain
- Run
setup.batto install required packages - Wait for the installation to complete
- Then run
run.bat
- Open
config.jsand check for missing commas, quotes, or brackets - Compare your config against the example in the README
- Ensure all strings are properly quoted
No console output after starting
No console output after starting
Cause: The application may be running but not logging events.Solution:
- Check if
verboseLoggingis set tofalsein yourconfig.js - If you want to see connection events, set
verboseLogging: true - Save and restart the application
User events (enabled/disabled status, webhook executions) are logged regardless of the
verboseLogging setting (index.js:40-41).Reconnection loop
Reconnection loop
Symptoms: The application continuously disconnects and reconnects.Possible causes:1. Duplicate connection with reconnectOnDuplicateConnection enabled
- Set
reconnectOnDuplicateConnection: falseinconfig.js - Close any other instances of the webhook client
- Restart the application
- Check your network stability
- Try connecting from a different network
- Contact your ISP if issues persist
- Wait for the reconnection interval to stabilize (up to 2 minutes)
- Check Sol’s Stat Tracker status/announcements
- Report persistent issues to the developer
Messages not appearing in Discord
Messages not appearing in Discord
Cause: Webhook configuration issue or permissions problem.Solution:
- Verify the webhook URL is correct in
config.js - Check that the webhook has permission to post in the target channel
- Test the webhook by using
/enablestattrackerin Discord - Look for webhook errors in the console output
- Ensure Sol’s Stat Tracker is properly configured to use your token
Getting help
If you continue to experience issues after trying the solutions above:- Check the console output for specific error messages
- Note the error code or message text
- Verify your configuration matches the examples in the README
- Contact the developer (@mongoo.se) with:
- The error code or message
- Your console output (remove sensitive tokens)
- Steps you’ve already tried
The application logs all important events with the webhook ID prefix (e.g.,
ID: 1234567890123456) to help with debugging (index.js:21, 32, 73, 77, 83, 139, 155).