> ## Documentation Index
> Fetch the complete documentation index at: https://docs.breezehost.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Common Errors

> Troubleshoot common bot hosting errors including Pterodactyl panel issues and runtime failures.

# Common Errors

Running into issues? This page covers the most common errors you'll encounter when hosting a Discord bot, from Pterodactyl panel problems to runtime crashes.

## Pterodactyl Panel Errors

### Server Won't Start / Stuck on "Starting"

**Symptoms**: The server stays on "Starting" and never transitions to "Running", or it immediately goes back to "Offline".

**Causes & Fixes**:

<Accordion title="Incorrect startup command">
  The startup command doesn't match your actual entry file. Go to **Settings > Startup** and verify the command points to the correct file:

  * If your file is `bot.py`, the command should be `python bot.py`
  * If your file is `index.js`, the command should be `node index.js`

  A mismatch like `python main.py` when your file is named `bot.py` will cause the server to fail silently.
</Accordion>

<Accordion title="Main file not at root level">
  Your entry file is inside a subfolder (e.g., `my-bot/bot.py`) instead of at the root of the file manager. The server looks for your file at the root level. See [File Structure](/bot-hosting/file-structure) for how to fix this.
</Accordion>

<Accordion title="Missing dependencies">
  Your bot requires packages that aren't installed. Make sure you have:

  * **Python**: A `requirements.txt` at the root with all your packages listed
  * **JavaScript**: A `package.json` at the root with dependencies defined

  Check the console output for lines like `ModuleNotFoundError` or `Cannot find module` — these confirm missing dependencies.
</Accordion>

### "Failed to Start" or Exit Code Errors

**Common exit codes**:

| Exit Code | Meaning                            | Likely Fix                                                                                        |
| --------- | ---------------------------------- | ------------------------------------------------------------------------------------------------- |
| **1**     | General error / uncaught exception | Check console for the error traceback — usually a code bug or missing config                      |
| **127**   | Command not found                  | Your startup command references a binary that doesn't exist (e.g., `python3` instead of `python`) |
| **137**   | Out of memory (OOM killed)         | Your bot is using more RAM than your plan allows — optimize memory usage or upgrade               |
| **139**   | Segmentation fault                 | Rare — usually caused by a native dependency issue. Try reinstalling dependencies                 |

### Console Shows No Output

If the console is completely blank after starting:

* Your startup command may be wrong — double-check the filename
* Your bot might be crashing before it can print anything — add a simple `print("Starting...")` or `console.log("Starting...")` as the very first line of your entry file to verify it's being executed

### File Manager Won't Upload

* **File too large**: The panel has upload size limits. For large uploads, use SFTP instead. See [Uploading Files](/bot-hosting/uploading-files).
* **Permission error**: Try refreshing the page and re-uploading. If it persists, open a support ticket.

***

## Python Errors

### `ModuleNotFoundError: No module named 'xyz'`

Your bot is trying to import a package that isn't installed.

**Fix**: Add the missing package to your `requirements.txt` file and restart the server:

```
discord.py
python-dotenv
aiohttp
```

Make sure `requirements.txt` is at the **root level** of your server files.

### `SyntaxError: invalid syntax`

Usually means you're running Python 2 syntax on a Python 3 server, or there's a genuine typo in your code.

**Fix**: Test your code locally with `python bot.py` to find the exact line causing the issue.

### `discord.errors.LoginFailure: Improper token has been passed`

Your bot token is invalid, missing, or incorrectly loaded.

**Fix**:

* Verify your token in the [Discord Developer Portal](https://discord.com/developers/applications)
* If using a `.env` file, make sure there are no extra spaces or quotes around the token
* If using a config file, check that your code reads the correct key
* Try resetting your token in the Developer Portal and updating it on the server

### `discord.errors.PrivilegedIntentsError`

Your bot needs privileged intents (like Message Content) that aren't enabled.

**Fix**: Go to the [Discord Developer Portal](https://discord.com/developers/applications) > your app > **Bot** tab > enable the required intents (Message Content, Server Members, Presence).

***

## JavaScript / Node.js Errors

### `Error: Cannot find module 'xyz'`

A required npm package is missing.

**Fix**: Make sure your `package.json` includes all dependencies and is at the **root level**. The server installs packages from `package.json` on startup. If a package is missing from `package.json`, add it:

```json theme={null}
{
  "dependencies": {
    "discord.js": "^14.14.1",
    "dotenv": "^16.3.1"
  }
}
```

### `Error [TOKEN_INVALID]: An invalid token was provided`

Same as the Python token error — your token is wrong or not being loaded.

**Fix**: Check your token source (`.env`, `config.json`, or environment variable) and verify it matches the token from the Discord Developer Portal.

### `TypeError: Cannot read properties of undefined`

Your code is trying to access a property on something that doesn't exist yet.

**Common causes**:

* Trying to use `client.user` before the bot is ready — wrap it in a `ready` event
* Missing or malformed config values
* API responses returning unexpected data

### `EADDRINUSE: address already in use`

Something is already listening on the port your bot is trying to use. This usually happens if your bot runs a web server alongside the Discord connection.

**Fix**: Use the port assigned by the panel via the environment variable (typically `process.env.SERVER_PORT` or `process.env.PORT`) instead of hardcoding a port number.

***

## General Issues

### Bot Goes Offline After a Few Minutes

* **No keep-alive mechanism**: If you're using a free-tier database or external API that disconnects after inactivity, make sure your code handles reconnection
* **Unhandled promise rejection** (JS) or **unhandled exception** (Python): Add global error handlers so your bot doesn't crash on unexpected errors

**Python**:

```python theme={null}
@bot.event
async def on_error(event, *args, **kwargs):
    print(f"Error in {event}")
```

**JavaScript**:

```javascript theme={null}
process.on('unhandledRejection', (error) => {
  console.error('Unhandled promise rejection:', error);
});
```

### Bot Runs Out of Memory

If your bot gets killed with exit code **137**:

* Avoid storing large amounts of data in memory (use a database instead)
* Check for memory leaks — objects that grow over time without being cleaned up
* Consider upgrading to a plan with more RAM

### Bot Is Online but Not Responding to Commands

* **Missing Message Content Intent**: If using message-based commands (not slash commands), enable the Message Content intent in the Developer Portal
* **Wrong prefix**: Double-check your command prefix matches what you're typing
* **Slash commands not synced**: If using slash commands, make sure you've synced them with Discord (this is a one-time step after adding new commands)

## Still Stuck?

If none of the above fixes your issue:

* **Check the console** carefully for the full error message and traceback
* **Search the error** in your bot library's documentation or GitHub issues
* **Open a support ticket** in our [Discord server](https://discord.gg/breezehost) — include the full console output and a description of what you've already tried
