Docs · When something is wrong

Troubleshooting: my bot will not start

All docs

Start with the console. Scroll to the last lines before the crash message. Most of the errors below also get a [SnowServers] Hint: line with the fix.

ModuleNotFoundError: No module named '...'

A package your bot imports is not in requirements.txt. Add it and restart.

The name to add is not always the name you import. The common ones:

  • import discord → discord.py
  • import dotenv → python-dotenv
  • import yaml → PyYAML
  • import PIL → Pillow
  • import bs4 → beautifulsoup4

If the module is one of your own files, check it was uploaded and sits where the import expects it.

Error: Cannot find module '...'

The JavaScript version of the same thing. A package name ('discord.js') means it is missing from dependencies in package.json: run npm install discord.js on your computer and upload or push the updated package.json. A path ('./commands/ping') means that file is not where the code expects it. Linux file names are case-sensitive, so Ping.js and ping.js are different files here even if they were not on Windows.

LoginFailure: Improper token has been passed, or TokenInvalid

The token is wrong. Usually one of:

  • It was reset in the Developer Portal and the old one is still in Startup. Reset it again, copy the new one, paste it into Bot token.
  • A space or line break came along when you pasted it.
  • That is the Client Secret or Application ID, not the bot token. The token is on the Bot page.

To check a token without starting the bot, open Bot settings in the panel and press Check the token. Discord answers with the bot's name if the token works.

KeyError: 'BOT_TOKEN', or the token is None

Bot token on the Startup page is empty. Paste the token in, wait a moment for it to save, and restart.

AttributeError: partially initialized module 'discord' has no attribute 'Client'

A file in your bot's folder is called discord.py (or there is a folder called discord), so import discord loads your own file instead of the library. Python 3.13 and later say it outright: consider renaming 'discord.py' since it has the same name as the library. Rename your file (bot.py is usual, and set Bot file on Startup to match), delete the __pycache__ folder in Files, and restart. The same goes for disnake.py, nextcord.py and friends.

AttributeError: module 'discord' has no attribute 'Bot' (or 'slash_command')

The code is written for Pycord, which has discord.Bot and @bot.slash_command, but discord.py is installed. Both install under the name discord and break each other when both are there. Keep only py-cord in requirements.txt, delete the .local folder in Files (for a bot in bots, its .snowservers/bots/NAME/venv) so the old package goes too, and restart; everything is installed again from the list. The console warns at start when requirements.txt lists both.

TypeError [ClientMissingIntents]: Valid intents must be provided for the Client

discord.js 13 and later need intents when the client is made: new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] }), plus GatewayIntentBits.MessageContent if the bot reads what people write (switch that one on in the Developer Portal too).

RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited

The bot starts, but the commands in your cogs never appear. In discord.py 2, load_extension and add_cog are async: call them with await inside setup_hook, and make each cog file's setup() an async def that awaits bot.add_cog(...). Old tutorials were written for discord.py 1.

Inviting the bot says "Integration requires code grant"

Requires OAuth2 Code Grant is switched on for the bot in the Developer Portal (your application, Bot). It is only for bots that run their own OAuth2 sign-in; for everyone else it breaks the invite link. Switch it off and invite again. Check the token on the panel's Bot settings page points this out.

A bot token is written into bot.py

The console found something shaped like a Discord bot token inside one of your code files (it names the file, never the token). A token in code goes wherever the code goes: into a GitHub repository, a paste, a screenshot. Discord scans public GitHub for tokens and resets any it finds, which logs your bot out. Put the token in Startup > Bot token (or a bot's own .env) and read it from the environment: os.environ["BOT_TOKEN"] in Python, process.env.BOT_TOKEN in Node. If the code was ever public, reset the token in the Developer Portal too. Keeping a bot token safe.

Unknown interaction (10062), or "The application did not respond"

Discord gives a bot 3 seconds to answer a slash command or a button. Anything slower (a database query, a web request, generating an image) has to say "working on it" first: await interaction.response.defer() in discord.py or await interaction.deferReply() in discord.js, then send the real answer as a follow-up (interaction.followup.send, interaction.editReply). If it happens even for instant commands, check the bot is not also running somewhere else, such as your own computer: two copies both try to answer, and one is always late.

Interaction has already been acknowledged (40060), or InteractionAlreadyReplied

The bot answered the same interaction twice: two reply calls, or a reply after a defer. After the first response use a follow-up (followup.send in discord.py, followUp or editReply in discord.js). Two copies of the bot running at once cause this too.

Invalid Form Body (50035)

Discord refused a message because part of it breaks a limit: message text up to 2000 characters, an embed title up to 256, a description up to 4096, a field value up to 1024, no empty field names or values, at most 25 fields. The lines right after the error name the part, for example embeds[0].fields[2].value.

Shard ID None heartbeat blocked for more than 10 seconds

discord.py runs everything on one event loop, and something in your code held it for 10 seconds, during which the bot could not answer Discord (it may show offline, or drop commands). The usual causes: time.sleep(...) (use await asyncio.sleep(...)), the requests library (use aiohttp), and slow work inside a command, such as a big file or an image (run it with await asyncio.to_thread(func, ...)). The traceback printed after the warning shows the line it was stuck on.

There is a .env.example here but no .env

The bot's code came with a .env.example: a list of the settings it reads, with blank or sample values. The real ones go in a file called .env, which is never in the repository, so a fresh upload or clone does not have it. Open Bot settings in the panel: it lists what .env.example asks for, and Add puts each one in the form. Fill them in and save. If the console says .env.example lists settings that .env does not fill in, the file exists but some are still empty; add only the ones your bot needs, since examples often list optional ones too. Put the main bot's token in Startup > Bot token, not in .env.

PrivilegedIntentsRequired, DisallowedIntents, or Used disallowed intents

Your code asks for an intent (members, presences or message content) that is not switched on for your bot. In the Developer Portal, open your application, then Bot, and turn on the intents your code uses. Or stop asking for ones you do not need.

Check the token on the Bot settings page lists which of the three are on for your bot right now.

The bot is online but ignores commands

  • Prefix commands (!ping) need Message Content Intent on in the Developer Portal and intents.message_content = True in your code.
  • Slash commands need syncing once with await bot.tree.sync(), and can take a moment to appear. Re-open Discord if they do not.
  • Check the bot has permission to read and send messages in that channel.

There is no Python file to run, or Bot file is set to ..., but there is no ...

Nothing was found to start. Either:

  • your main file has a name that is not guessed: set Bot file on Startup to it, for example src/main.py or npm start,
  • Bot file names a file that is not there: check the spelling and the folder, or clear it to have it found automatically, or
  • a zip unpacked into a subfolder: the console says which folder has code in it. Move its contents up to the top folder. See Uploading files.

Git repository is set, but this server already has code that is not from Git

The clone did not run, so nothing of yours was overwritten. Delete the code it lists, then restart. .env and data files can stay. Git deploy.

The repository has files with the same names as files already here

A file on the server (often a data file or a config) has the same name as one in the repository, so the clone did not run rather than replace yours. Download it if you need it, delete or rename it in Files, then restart.

Git could not open the repository

The link is wrong, or the repository is private and there is no working token. Check the link opens in a browser while signed out. For a private repository, add a token in Git access token, and check it has not expired and can read that repository.

Did not update from Git: these files were edited here

You changed a file on the server that the new commits also change, so the update was skipped instead of throwing your change away. The bot is still running the previous commit. Make the change in your repository, or delete the edited file on the server, then restart.

SyntaxError: Cannot use import statement outside a module

Your code uses import in a file Node has been told is CommonJS: package.json says "type": "commonjs", or the file ends in .cjs. Change it to "type": "module", or rename the file to .mjs. (Only a MODULE_TYPELESS_PACKAGE_JSON warning? The bot runs; adding "type": "module" silences it.) JavaScript bots.

Aborting automatic restart, last crash occurred less than 60 seconds ago

Not the error itself. The bot crashed twice in a row quickly, so it was left stopped. Scroll up for the real error, fix it, press Start. More about crashes.

Exit code: 137, Out of memory: true

The bot used more memory than your plan has. See running out of memory.

The panel says the server is suspended

The subscription behind the server is not active: cancelled, or a payment failed and every retry did too. A free trial or free month for a Discord bot that already had one is also suspended until its first payment. Open the billing page from snowservers.com/login to check, or contact us.

pip or npm errors before the bot starts

See Installing packages for failed installs, conflicts and a full disk.

SyntaxError on a line that looks fine

Your code uses syntax newer than the server's Python or Node.js. In Python, some typing syntax needs 3.12. Switch versions under Startup.

Can't connect to MySQL server on 'localhost', or ECONNREFUSED 127.0.0.1:3306

Your database does not run inside your server, so localhost finds nothing. Use the address, username and password from the Databases tab (the eye button), ideally from your .env as DB_HOST, DB_USER and so on. Using your MySQL database.

sqlite3.OperationalError: database is locked

Something else has the same SQLite file open for writing. The usual cause is two bots in bots pointing at one .db file: give each bot its own file, or keep shared data in the MySQL database. A bot that opens several connections to the same file can do it to itself too; use one connection.

DiscordAPIError[50013]: Missing Permissions, and the bot stops

Discord refused something the bot tried (sending in a channel it cannot see, adding a role above its own). That on its own is harmless, but in Node.js an error nobody catches stops the whole program. Give the bot's role the permission it needs in that channel, and catch the error in your code (try { ... } catch around await, or .catch() on the promise) so one refusal cannot take the bot down.

EACCES: permission denied, or Read-only file system, for a path like /data

Your bot can only write inside its own server folder (/home/container). Paths that start at the root, like /data/bot.db or /app/config.json, come from Docker or VPS tutorials and point somewhere it cannot write. Use a path relative to the bot instead: data/bot.db.

sqlite3.OperationalError: unable to open database file

Usually the folder the database should be in does not exist yet. SQLite creates the file but not the folder. Create it first (os.makedirs("data", exist_ok=True) in Python, fs.mkdirSync("data", {recursive: true}) in JavaScript), and keep the path inside the server folder.

Connection or SSL errors reaching another service

Outgoing connections are allowed, with a few deliberate exceptions: sending email directly over SMTP (ports 25, 465 and 587) is blocked, so use an email service's HTTPS API instead; private network addresses are blocked; and a server opening more than about 60 new connections a second has the extra dropped. If something ordinary is failing, check the service's own status page, then tell us.

Still stuck

Ask in the Discord or email us. Include:

  • The last 20 or so lines of the console, copied as text rather than a photo.
  • What you changed just before it broke.
  • Your server's name as shown in the panel.

Never include your bot token. Check the pasted text for it before sending. If you did post it somewhere, reset it in the Developer Portal.

Something here wrong or out of date? Tell us and it gets fixed.