---
title: "Fix Telegram Bot Errors - Troubleshooting Guide | FPS.ms"
description: "Fix common Telegram bot issues on FPS.ms: token errors, missing modules, bot not responding, and polling conflicts. Solutions for Python and Node.js."
url: https://fps.ms/docs/telegram-bots/troubleshooting
---
# Troubleshooting

Running into issues with your Telegram bot on FPS.ms? This guide covers the most common problems and their solutions for both Python and Node.js bots.

## Bot won't start

### "No such file or directory: app.py"

**Full error:** `/usr/local/bin/python: can't open file '/home/container/app.py': [Errno 2] No such file or directory`

**Cause:** FPS.ms looks for `app.py` as the Python entry point, but the file is missing or named differently.

**Fix:**
1. Go to the **Files** tab in the panel
2. Make sure you have a file named exactly `app.py` in the root directory (not inside a subfolder)
3. If your main file has a different name, rename it to `app.py`

### "Cannot find module" (Node.js)

**Full error:** `Error: Cannot find module 'telegraf'`

**Cause:** Dependencies are not installed, usually because `package.json` is missing or incorrect.

**Fix:**
1. Verify you have a `package.json` in the root directory
2. Make sure `telegraf` (or your bot framework) is listed under `dependencies`
3. Do **not** upload the `node_modules` folder — FPS.ms runs `npm install` automatically
4. Restart your server to trigger a fresh install

### "ModuleNotFoundError" (Python)

**Full error:** `ModuleNotFoundError: No module named 'telegram'`

**Cause:** The `requirements.txt` file is missing or doesn't include your bot library.

**Fix:**
1. Create a `requirements.txt` file in the root directory
2. Add your packages:

```txt title="requirements.txt"
python-telegram-bot
python-dotenv
```

3. Restart your server — FPS.ms installs packages from `requirements.txt` on startup

!!! tip "Check your imports" "Every `import` statement in your code that isn't a Python built-in needs a matching line in `requirements.txt`. For example, if you use `import requests`, add `requests` to the file."

## Token errors

### "Unauthorized" or "Not Found: 404"

**Cause:** The bot token is wrong, expired, or not set.

**Fix:**
1. Open your `.env` file in the **Files** tab on the FPS.ms panel
2. Check that `BOT_TOKEN=` contains your full token with no extra spaces or line breaks
3. If in doubt, get a fresh token from [BotFather](https://fps.ms/docs/telegram-bots/creating-your-bot-with-botfather.md) using `/revoke` and paste the new one

### "Conflict: terminated by other getUpdates request"

**Full error:** `telegram.error.Conflict: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running`

**Cause:** Two instances of your bot are trying to poll Telegram at the same time. This happens when:
- You're running the bot locally AND on FPS.ms
- The server restarted but the old process didn't stop cleanly

**Fix:**
1. Stop any local instances of your bot
2. On FPS.ms, click **Stop** and wait a few seconds, then click **Start**
3. If it persists, wait 1-2 minutes — Telegram automatically drops stale polling connections

!!! info "This is the most common Telegram bot error" "Unlike Discord bots, Telegram only allows one polling connection per bot token at a time. Always stop your local bot before starting on FPS.ms, or vice versa."

## Bot not responding

### Bot starts but doesn't reply to messages

**Cause:** Several possible reasons.

**Fix — check in order:**
1. **Token is correct** — send `/start` to your bot in Telegram and check the console for errors
2. **Handlers are registered** — make sure your command handlers are added before `run_polling()` (Python) or `bot.launch()` (Node.js)
3. **Bot is polling** — check the console output. You should see `Bot is running...` or similar
4. **Privacy mode in groups** — if your bot doesn't respond in groups, BotFather's privacy mode may be on. Type `/setprivacy` in BotFather and set it to `Disable` to let your bot see all messages in groups

### Bot works in private but not in groups

**Cause:** Telegram's bot privacy mode is enabled by default. In privacy mode, bots only receive commands (`/command`) in groups, not regular messages.

**Fix:**
1. Open [@BotFather](https://t.me/BotFather) in Telegram
2. Type `/setprivacy`
3. Select your bot
4. Choose **Disable**
5. Remove and re-add the bot to the group for the change to take effect

## Bot goes offline

### Bot starts then immediately stops

**Cause:** Your code has an error that crashes the bot after starting.

**Fix:**
1. Check the **Console** tab for error messages — the last few lines before it stops will tell you what went wrong
2. Common causes:
   - Missing environment variable — see [environment variables guide](https://fps.ms/docs/telegram-bots/using-environment-variables.md)
   - Syntax error in your code — fix and re-upload via [SFTP](https://fps.ms/docs/getting-started/connecting-to-sftp.md) or the panel
   - Missing dependency — add it to `requirements.txt` or `package.json`

### Bot runs for a while then disconnects

**Cause:** Usually a memory limit, unhandled error, or network timeout.

**Fix:**
1. **Memory limit:** Free servers have limited RAM. If your bot caches a lot of data in memory, consider using a database or file storage instead.
2. **Unhandled errors:** Add error handling to prevent crashes:

**Python:**
```py
from telegram.ext import ApplicationBuilder

app = ApplicationBuilder().token(os.environ['BOT_TOKEN']).build()

# Log errors instead of crashing
async def error_handler(update, context):
    print(f'Error: {context.error}')

app.add_error_handler(error_handler)
```

**Node.js:**
```js
bot.catch((err, ctx) => {
    console.error(`Error for ${ctx.updateType}:`, err);
});

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

3. **Network timeouts:** Telegram polling connections can time out. The `python-telegram-bot` library handles reconnection automatically. For Telegraf, it also reconnects by default.

### Bot goes offline at the same time every day

**Cause:** Free servers need to be renewed regularly. If the server stops, so does your bot.

**Fix:**
- Check your [server renewal status](https://fps.ms/docs/getting-started/how-server-renewal-works.md) on the panel
- Set up a [schedule](https://fps.ms/docs/getting-started/creating-schedules.md) to auto-restart your bot

## Dependency issues

### Python package version conflicts

**Cause:** Two packages require different versions of the same dependency.

**Fix:** Pin specific versions in `requirements.txt`:

```txt title="requirements.txt"
python-telegram-bot==21.10
python-dotenv==1.0.1
```

### Node.js "ERESOLVE unable to resolve dependency tree"

**Cause:** Package version conflicts in your `package.json`.

**Fix:**
1. Remove the `node_modules` folder and `package-lock.json` from your server files
2. Restart the server to trigger a fresh `npm install`
3. If the issue persists, update your `package.json` to use compatible versions

## Still need help?

If none of these solutions fix your issue:

1. Check the **Console** tab on the FPS.ms panel — error messages usually tell you exactly what's wrong
2. Join the [FPS.ms Discord server](https://fps.ms/discord) for community support
3. Review the official documentation for your bot library:
   - Python: [python-telegram-bot docs](https://docs.python-telegram-bot.org/)
   - Node.js: [Telegraf docs](https://telegraf.js.org/)
   - Telegram Bot API: [Telegram Bot API docs](https://core.telegram.org/bots/api)

---

[FPS.ms](https://fps.ms/index.html.md) · [All pages](https://fps.ms/llms.txt) · [Documentation](https://fps.ms/docs/llms.txt)
