# Telethon errors (FloodWaitError, account banned, get_entity, NewMessage, no login code): how do I fix them?

Most Telethon issues in production come from Telegram's account-level defenses and client cache rules: repeated `get_entity` calls trigger hours-long `FloodWaitError`, VoIP/brand-new numbers get banned on authorization, bare numeric channel IDs without `-100` fail in `get_entity`, and `events.NewMessage` silently skips some large public channels or stalls after 10–20 hours. Cache entity IDs/hashes, reuse your `.session` file, and poll critical channels—or read public channels without any Telegram account via XTikAPI at $0.002 a call.

Updated 2026-11-25

## Five common Telethon failures and fixes

| Problem | Cause in Telethon issues | Practical fix |
| --- | --- | --- |
| `FloodWaitError` (up to 24 hours) | Calling `get_entity('username')` (`ResolveUsernameRequest`) repeatedly or polling tightly (issues #494, #3107) | Resolve each channel once, persist `(id, access_hash)` and reuse; use larger `limit` and keep `.session` |
| Account banned on or after login | Virtual/VoIP numbers, brand-new accounts authorizing immediately, or flagged region/IP (issue #824, 212 comments) | Use an aged non-VoIP number and stable IP; appeal at `login@stel.com`, `recover@telegram.org`, or `telegram.org/support` |
| `get_entity(channel_id)` fails or returns `InputPeerUser` | Passing an unmarked numeric ID without `-100`, or entity missing from session cache after upgrade (issue #4084) | Always pass marked `-100<id>` or `@username`, and warm the cache via `get_dialogs()` |
| `events.NewMessage` silent on some public channels or stops after 10–20h | Telegram delivers public-channel updates best-effort to user clients (issues #4345, #4521; also seen in Pyrogram) | Reconnect periodically (e.g. every 24h) or poll by last seen message ID for guaranteed delivery |
| No in-app login code arrives | Transient Telegram-side block on third-party logins even when `@SpamBot` shows clean (issue #4730, Jan 2026) | Stop retrying rapidly, wait 24–48h, and always preserve the `.session` file once logged in |

## Monitoring public Telegram channels without a Telegram account

Private groups and DMs still require your own Telegram account. For **public channels**, polling an HTTP API eliminates bans, login codes, entity caches, and missed `NewMessage` events:

1. Channel info: `telegram.channels.detail` with `channel` (public username) returns title, description, and subscriber count.
2. Incremental polling: save the newest message ID per channel, then call `telegram.channel_posts.list` with `channel` and `after` (or `before` to backfill history).
3. Search & discovery: `telegram.channel_posts.search` (`channel`, `keyword`), `telegram.posts.detail`, and `telegram.channels.similar`.

Cost check: 50 channels checked every 6 hours for 30 days = 6,000 calls × $0.002 = $12; daily checks for 20 channels = $1.20/month.

## Why XTikAPI

- XTikAPI reads Telegram with 5 endpoints from $0.002 a call, and a failed call is not charged.
- Fewer tokens for AI: across 5 recorded live Telegram calls (2026-11-18), raw platform JSON is ~16k tokens vs ~7k via XTikAPI REST (56.1% fewer) and ~7k via MCP (53.7% fewer).
- See before you pay: 192 of 229 endpoints show a recorded real response on their page (5 of 5 for Telegram).
- Made for AI: hosted OAuth MCP server (/v1/mcp), Markdown twin per page, llms.txt and OpenAPI for ChatGPT, Claude and Cursor.
- Free trial: a verified account gets $0.50, no card.

## Endpoints

- [Telegram channel messages API](https://xtikapi.com/apis/telegram/channel_posts/list) ($0.002 a call): Messages posted in a public Telegram channel.
- [Telegram channel info API](https://xtikapi.com/apis/telegram/channels/detail) ($0.002 a call): One public Telegram channel: title, description, subscribers.
- [Telegram channel message search API](https://xtikapi.com/apis/telegram/channel_posts/search) ($0.002 a call): Search the messages of one public Telegram channel.
- [Telegram message details API](https://xtikapi.com/apis/telegram/posts/detail) ($0.002 a call): One message from a public Telegram channel.
- [Telegram similar channels API](https://xtikapi.com/apis/telegram/channels/similar) ($0.002 a call): Channels Telegram suggests as similar to one channel.

## More about Telegram

- [Telegram API](https://xtikapi.com/apis/telegram)
- [How can I read a public Telegram channel's messages without the Telegram API?](https://xtikapi.com/answers/telegram-channel-messages-without-api)

## Sources

What this page says about other products comes from their own pages and docs, read on 2026-11-25.

- [Telegram API: error handling (FLOOD_WAIT_X)](https://core.telegram.org/api/errors)
- [Telethon issue #494 (FloodWaitError on get_entity)](https://github.com/LonamiWebs/Telethon/issues/494)
- [Telethon issue #824 (account banned)](https://github.com/LonamiWebs/Telethon/issues/824)
- [Telethon issue #4084 (cannot obtain Channel via get_entity by ID)](https://github.com/LonamiWebs/Telethon/issues/4084)
- [Telethon issue #4345 (NewMessage not triggered for certain channels)](https://github.com/LonamiWebs/Telethon/issues/4345)
- [Telethon issue #4730 (no login code anymore)](https://github.com/LonamiWebs/Telethon/issues/4730)
- [Telegram support](https://telegram.org/support)

## Questions

### What is the `-100` prefix in Telethon channel IDs?

It is Telegram's marked ID format for channels/supergroups; passing the bare number without `-100` can resolve as a user ID (`InputPeerUser`) or fail.

### Should I just catch `FloodWaitError` and sleep?

Short waits can be slept, but multi-hour waits mean you are calling an expensive method like `ResolveUsernameRequest` too often—cache IDs and hashes instead.

---

XTikAPI: one API key for public social media data, prepaid per call. [HTML version](https://xtikapi.com/answers/telethon-errors-and-fixes) · [llms.txt](https://xtikapi.com/llms.txt) · [OpenAPI](https://xtikapi.com/openapi.json)
