Bug Report: Telegram Plugin Inbound Messages Broken on Windows
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Environment:
- Claude Code CLI v2.1.85 (latest)
- Windows 11 (10.0.22631)
- Bun v1.3.11
- Plugin: telegram@claude-plugins-official v0.0.4
- Bot: @Omnidel_Claudebot (token valid, verified via getMe)
What's broken:
The Telegram plugin loads MCP tools correctly — outbound messages work (the reply tool sends messages to Telegram successfully). But inbound messages
never arrive. The bot never starts polling Telegram's getUpdates API.
Root cause identified:
In server.ts, the bot startup code is in an async IIFE at line 959:
void (async () => {
await bot.start({ ... })
})()
This runs AFTER await mcp.connect(new StdioServerTransport()) on line 614. On Windows, when Claude Code spawns the MCP server via bun run --cwd
${CLAUDE_PLUGIN_ROOT} --shell=bun --silent start, the code after mcp.connect() never executes. The async IIFE is silently dropped.
Proof:
- curl getUpdates returns {"ok":true,"result":[]} — no 409 conflict, meaning nothing is polling
- Running server.ts manually with (sleep 10 | bun server.ts) works perfectly — bot immediately prints telegram channel: polling as @Omnidel_Claudebot and
polls successfully
- When Claude Code spawns it, the MCP handshake completes (tools register, outbound reply works), but bot.start() never fires
- Added process.stderr.write before bot.start() — the log line never appears when spawned by Claude Code, but does appear when run manually
What I tried (all failed):
- Clean reinstall (claude plugins install telegram) — same behavior
- Moving bot.start() before mcp.connect() — bot polls but MCP tools don't register
- Wrapping bot.start() in setTimeout(100) — still doesn't execute
- Changing .mcp.json to run bun server.ts directly instead of bun run --shell=bun --silent start — bun doesn't start at all
- Downgrading to plugin v0.0.1 — same issue
- Killing stale bun processes, clearing orphan markers — doesn't help
Timeline:
- Working perfectly until March 24, 2026
- On March 24, plugin was marked orphaned (.orphaned_at file created)
- Since then, every restart results in the same behavior: tools load, outbound works, inbound dead
Suspected cause:
The StdioServerTransport on Windows (via Bun) is consuming the event loop or blocking microtask execution after mcp.connect() resolves. The void (async ()
=> { ... })() IIFE schedules its execution as a microtask, but it never gets picked up.
Suggested fix:
Either:
- Start bot polling before mcp.connect() (requires restructuring so tools still register)
- Use setImmediate() or setTimeout(0) inside the MCP transport to yield the event loop
- Investigate how Claude Code spawns the bun subprocess on Windows — the --shell=bun flag may be the issue
Repro steps:
- Windows 11, install Claude Code 2.1.85
- claude plugins install telegram
- Configure bot token in ~/.claude/channels/telegram/.env
- Pair a Telegram user via /telegram:access
- Restart Claude Code
- Send a message to the bot — no response, no <channel> tag in session
- Run curl "https://api.telegram.org/bot<TOKEN>/getUpdates" — returns {"ok":true,"result":[]} (no polling)
What Should Happen?
Inbound Telegram messages should arrive in the Claude Code session as <channel source="telegram"> tags, and the bot should actively poll Telegram's
getUpdates API. The bot.start() async IIFE at the end of server.ts should execute after mcp.connect() resolves — as it does when running the server
manually outside of Claude Code.
Error Messages/Logs
# No explicit error — the failure is silent. bot.start() simply never executes.
▎ # Verification via Telegram Bot API:
▎ $ curl "https://api.telegram.org/bot<TOKEN>/getUpdates?limit=1&timeout=1"
▎ {"ok":true,"result":[]}
▎ # Returns 200 OK instead of 409 Conflict — proving nothing is polling.
▎ # When running manually (works correctly):
▎ $ (sleep 10 | bun server.ts)
▎ telegram channel: bot.start() IIFE entered
▎ telegram channel: calling bot.start() attempt=1
▎ telegram channel: polling as @Omnidel_Claudebot
▎ # When Claude Code spawns it as MCP server:
▎ # - MCP tools register successfully (outbound reply tool works)
▎ # - bot.start() IIFE never enters (stderr debug line never appears)
▎ # - No crash, no error, no orphan marker — just silent non-executi
Steps to Reproduce
Steps to Reproduce
▎ 1. Windows 11, install Claude Code v2.1.85
▎ 2. Install bun (npm i -g bun or via bun installer)
▎ 3. Run claude plugins install telegram
▎ 4. Set bot token: create ~/.claude/channels/telegram/.env with TELEGRAM_BOT_TOKEN=<your-token>
▎ 5. Launch Claude Code, send a DM to the bot on Telegram — bot responds with pairing code
▎ 6. Run /telegram:access pair <code> in Claude Code to pair
▎ 7. Restart Claude Code (/exit and relaunch)
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.85 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗