Docs · Running your bot

The console, crashes and automatic restarts

All docs

What the console shows

Three kinds of line:

  • Your bot's output, including errors and tracebacks.
  • Lines starting with [SnowServers]: what happened before your bot ran (Git, packages, which file started) and, if it stops, a hint about why.
  • Lines tagged Daemon: the server itself starting, stopping and noticing crashes.

The console only keeps recent output. Everything is also saved, with the time in UTC on each line, in .snowservers/logs/console.log in Files: your bot's output, the [SnowServers] lines and package installs, with a marker each time it starts and exits. When that file reaches 5 MB it moves to console.log.1 (then .2), so the logs never take more than about 15 MB.

Reading an error

In a Python traceback the error is the last line, and the lines above it say where in your code. In Node.js it is the line starting with the error's name, with the at ... lines below it.

Traceback (most recent call last):
  File "/home/container/bot.py", line 12, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
[SnowServers] Hint: Python cannot find 'requests'. Add requests to requirements.txt and restart.

The hint covers the errors people hit most: a missing package, a rejected token, privileged intents, running out of memory, Discord rate limits, JavaScript import problems. Troubleshooting has the rest.

What happens when it crashes

If your program exits for any reason while it is meant to be running, the console shows:

---------- Detected server process in a crashed state! ----------
Exit code: 1
Out of memory: false

and the server starts it again automatically. A clean exit counts too, so a bot that finishes and exits is restarted. Stopping it yourself from the panel is not a crash.

To hear about it without watching the console, set up crash alerts and get a Discord message with the reason. Without one, if your bot stops on its own and stays stopped for three hours, we email you once with what the console said.

Why it sometimes stays stopped

If it crashes again within 60 seconds of the last crash, you will see:

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

This stops a bot that fails the moment it starts (a bad token, a typo, a missing package) from restarting in a tight loop forever, which would also get it rate limited by Discord. Fix the error the console showed, then press Start.

Running out of memory

Each plan has a hard memory limit. If your bot goes past it, the system ends the process and you see:

[SnowServers] Hint: Your bot ran out of memory (1024 MB on this plan). ...
Exit code: 137
Out of memory: true

On Node.js, the heap is capped at three quarters of your plan's memory, so a JavaScript bot usually stops with JavaScript heap out of memory instead, which is easier to read. Either way it restarts like any other crash. If this keeps happening:

  • Watch the memory graph on the Console page. A line that climbs and never falls is a leak, often a list, dict, Map or cache your bot keeps adding to and never clears.
  • Bots in a lot of servers use more memory for Discord's own cache. Turn off intents you do not use (especially members and presences). discord.py: max_messages=None. discord.js: limit caches with makeCache and sweepers.
  • If it is genuinely using what it needs, move up a plan: change plan from the billing email, and your files are not touched. How much RAM a bot needs.

CPU

Going over your CPU share does not crash anything. Your bot is slowed to its share, which shows up as commands taking longer to answer. Discord bots are rarely busy enough for this, unless they process images or audio.

Stop, restart and force stop

  • Stop asks your program to exit and waits for it, so discord.py and discord.js can close their connection to Discord cleanly.
  • Restart stops it and starts it again. Use this after uploading new code or pushing to Git.
  • Force stop appears in place of Stop when a stop is taking too long, and ends the process immediately. Anything your bot had not saved is lost.

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