ESN Docs

Docs › Help

Common Discord bot errors and how to fix them

4 min readUpdated Oct 31, 2026

Fixes for the Discord bot errors we see most: invalid token, privileged intents, ModuleNotFoundError and npm errors, wrong Python or Node.js version, port already in use, and a bot that is online but not responding.

Start your server, open the Console and read the last few lines when it fails. Find the matching error below. For crashes, memory and disk problems, see Troubleshooting.

Faster: in the ESN Systems Discord, run /botfix and paste your error. ESN Helper replies with the usual fix and the right section of this page. Remove your bot token from the paste first.

Invalid token #

You'll see LoginFailure: Improper token has been passed (Python), TokenInvalid or An invalid token was provided (Node.js), or 401 Unauthorized.

  • Get a fresh token: Developer Portal → your app → Bot → Reset Token. Resetting makes the old one stop working.
  • Paste it into .env as DISCORD_TOKEN=... with no quotes, spaces or extra lines.
  • Check the file is named exactly .env (not env.txt) and sits in the top folder.
  • Check your code loads it: load_dotenv() in Python or require("dotenv").config() in Node.js, before the token is used. If the token comes back empty, the bot can't log in.

Setup steps: Add your token safely.

Privileged intents not enabled #

You'll see PrivilegedIntentsRequired (Python) or Used disallowed intents (Node.js).

  1. Open the Discord Developer Portal → your app → Bot.
  2. Under Privileged Gateway Intents, turn on the ones your code asks for: Presence, Server Members and/or Message Content. Save.
  3. Restart your server.

If you don't need an intent, remove it from your code instead. Bots in 100 or more servers need Discord's approval for these intents.

ModuleNotFoundError, "Cannot find module" or npm errors #

  • Python ModuleNotFoundError: No module named 'x': add the package to requirements.txt and restart. The import name isn't always the package name: dotenv is python-dotenv, PIL is Pillow, yaml is PyYAML, and discord is discord.py.
  • Node.js Cannot find module 'x': add it to dependencies in package.json (run npm install x on your computer and upload the new package.json), then restart. If the missing module is your own file, check the path and capitals.
  • npm: not found or node: not found: your bot is JavaScript but the server is set up for Python (or the other way round). Switch the server type. On an older free Nano, use the Bot type menu on your dashboard. Otherwise, open a ticket.
  • npm ERR! while installing: read the lines just above it. Usually a package name or version in package.json is wrong, or a package needs a newer Node.js (see the next section).
  • Make sure requirements.txt or package.json is in the top folder. If it's inside a subfolder, nothing gets installed.

Wrong Python or Node.js version #

Pick the version on the Startup page in the Docker Image box: Python 3.12 or 3.13, or Node.js 22 or 24. Restart after changing it.

  • No module named 'audioop' on Python 3.13: older discord.py versions need a module that Python 3.13 removed. Update to the latest discord.py in requirements.txt, or choose Python 3.12.
  • SyntaxError on code that works on your computer: check which Python version you use at home (python --version) and pick the same or newer.
  • Node.js packages that say Unsupported engine want a different Node.js version. Choose the one their docs name.

Port already in use #

You'll see OSError: [Errno 98] Address already in use (Python) or EADDRINUSE (Node.js).

  • Most Discord bots don't need a port at all. If you copied a "keep alive" web server from Replit or a tutorial, remove it. Your ESN server stays on by itself.
  • If your bot really runs a website or webhook, use your server's own port. You'll find it on the Network page, and your code can read it from the SERVER_PORT environment variable. Listen on 0.0.0.0.
  • Check your code doesn't start the web server twice, for example in two files.

Bot is online but doesn't respond #

  • Prefix commands like !help don't work: the bot can't read messages without the Message Content intent. Turn it on in the Developer Portal (see above) and in your code: intents.message_content = True in discord.py, or GatewayIntentBits.MessageContent in discord.js. Restart.
  • Slash commands don't show up: invite the bot with the applications.commands scope, and make sure your code registers (syncs) its commands when it starts. New global commands can take a while to appear; restarting Discord helps.
  • Nothing happens in one channel: the bot needs permission to view and send messages there. Check the channel's permissions for the bot's role.
  • The bot replies twice: another copy is running with the same token, often on your computer or an old host. Stop the other copy, or reset the token so only the ESN server has it.
Still stuck? Copy the last 20 lines of your console (remove your token if it appears) and post them in a ticket on the ESN Systems Discord. See How to contact support.

More guides: Discord slash commands not showing up? How to register and sync them, Discord privileged intents explained: message content, members and presence, Why is my Discord bot offline? Causes and fixes.

Still stuck? Use the live chat on the panel or ask in the ESN Systems Discord. Last updated October 31, 2026.