The bot refuses to connect: token missing or invalid
Check the variable name, that the secret is set and the Discord permissions, without exposing it in the logs.
A token may be valid but never read if the code expects DISCORD_TOKEN while the panel defines TOKEN. It must remain in a secret variable, never in the repository.
Step-by-step procedure
-
Check the exact name
Locate process.env.DISCORD_TOKEN or os.getenv("DISCORD_TOKEN") then use the exact same key.
-
Remove spaces and quotes
Paste only the token value. Do not surround it with quotes in the panel field.
-
Reset it if exposed
If the token appears in a log, a screenshot or Git, reset it immediately in the Discord Developer Portal.
-
Check the privileged intents
An error related to privileged intents is fixed in the Discord Developer Portal and in your code, not by changing the token.