NEW 📢 Black Friday: our launch offer ends 30 Nov. Up to 70% off your first month on every game!See plans
Black FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 58mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 58mBlack FridayUp to 70% off your first month, ends 30 NovEnds in 9d 02h 58m

Common Discord bot errors and what they mean

Discord bot hostingUpdated Oct 28, 20266 min read

Find the message in Console (or under a field in the panel), then use the row below. For the most common ones the panel also shows a banner above the console with a button to the fix.

Login errors

MessageMeaningFix
An invalid token was provided, TokenInvalid, LoginFailure: Improper token has been passed, close code 4004Discord refused the token: it was reset, or copied wrong. Banner: Discord did not accept your bot token.Reset the token in the Developer Portal, then Replace token on the Bot page, pane Discord, and restart.
Used disallowed intents, PrivilegedIntentsRequired, close code 4014Your code asks for a privileged intent that is off. Banner: Your bot needs an intent that is switched off.Fix "Used disallowed intents"
A KeyError naming your token variable (Python), or a token that is undefined / None although the Discord pane says ValidYour code reads the token under another name.Read DISCORD_TOKEN (or TOKEN, BOT_TOKEN, DISCORD_BOT_TOKEN): those are the names the token reaches your code under. Restart once after saving the token.

Messages when you paste a token

MessageFix
That looks like the Client Secret, not the token.Copy the token from Bot, Reset Token in the Developer Portal, not from OAuth2.
That is a Discord account token, not a bot token.Use your application's bot token. Self-bots break Discord's terms and are not hosted.
That is not a Discord bot token.Copy the whole token again.
This bot was checked a lot in a short time. Try again in 30 seconds.Wait for the time shown, then Check now.

Start errors from PlayNHost

LineFix
[PlayNHost] Your bot is not set up yet: ... (banner Your bot has no code yet)The Entry file (main file, jar, program or project) is not on the server. Upload it or fix the name on the Code pane.
[PlayNHost] ... is a Python file, but this server runs Node.js. (or the other way round)Change the type with Change what runs, keeping your files.
[PlayNHost] ... starts with ```, a Markdown code fence ...Delete the first and last ``` lines of the file in Files.
[PlayNHost] Some packages in Bot page, Code, Packages could not be installed.Fix the spelling in Packages; separate names with spaces.
[PlayNHost] A Git repository is set, but this server already has files, so it was not downloaded.How to deploy and update your Discord bot from GitHub

The full list with examples: Why your Discord bot keeps stopping.

Permission errors

MessageMeaningFix
DiscordAPIError[50001]: Missing AccessThe bot cannot see that channel or server.Let the bot's role view the channel, or check the bot is still in that server.
DiscordAPIError[50013]: Missing PermissionsThe bot lacks a permission, or its role is below the role or member it acts on.Add the permission and move the bot's role above the roles it manages.
Cannot send messages to this user (50007)The user has direct messages closed, or shares no server with the bot.Catch the error in your code and answer in the channel instead.

Interaction errors

MessageMeaningFix
Unknown interaction (10062)The bot took more than 3 seconds to answer a slash command.Defer first (deferReply() / response.defer()), then answer.
Interaction has already been acknowledged (40060)Your code replied twice.Reply once, then use a follow-up or an edit.
Unknown Message (10008), Unknown Channel (10003)The message or channel was deleted.Check it still exists, and catch the error.

Package and code errors

MessageMeaningFix
Cannot find module 'x', ERR_MODULE_NOT_FOUNDA Node.js package is missing. Banner: A package your code needs is missing.Add it to package.json or to Packages.
ModuleNotFoundError: No module named 'x'A Python package is missing.Add it to requirements.txt or to Packages. The pip name can differ from the import name.
SyntaxError on line 1Often the wrong language for the server, or a ``` line from a chat.See the start errors above.

Memory, rate limits and the network

  • JavaScript heap out of memory, MemoryError, java.lang.OutOfMemoryError: the bot used all the memory its plan gives. Banner: Your bot ran out of memory. See How much RAM does a Discord bot need.
  • 429 Too Many Requests: the bot sends too fast. Libraries wait and retry by themselves; slow down loops that edit many messages or add many reactions. See How to avoid Discord rate limits and bans.
  • ECONNRESET, Connect Timeout Error, getaddrinfo EAI_AGAIN: a short network blip between the bot and Discord. Good libraries reconnect by themselves. If it never recovers, restart the bot.

Messages when you save an environment variable

  • DISCORD_TOKEN is set by PlayNHost and cannot be changed here.: the token and the names the panel manages (also TOKEN, BOT_TOKEN, DISCORD_BOT_TOKEN, GIT_TOKEN, NODE_OPTIONS, PATH, HOME, and your bot type's own settings such as MAIN_FILE) cannot be added as variables.
  • PYTHONPATH controls how the bot starts and cannot be set here.: names that change how a runtime or the shell starts (such as PYTHON..., NODE_PATH, JAVA_TOOL_OPTIONS, LD_...) are refused. In a pasted .env they are marked Skipped and the rest imports.

See How to set environment variables and secrets.

Already hosting your bot somewhere else? Move it to us

OUR LATEST BLOGS