[BUG] Telegram plugin: globally-enabled plugin spawns duplicate bot processes across sessions, causing message loss

Resolved 💬 3 comments Opened Apr 5, 2026 by hyunjae-labs Closed Apr 9, 2026

Description

When the Telegram plugin is enabled at the global scope (in ~/.claude/settings.json), every Claude Code session that starts — regardless of whether it uses --channels — spawns its own Telegram bot process. Multiple bot processes polling getUpdates with the same bot token compete for messages, causing silent message loss and intermittent 409 Conflict errors.

Steps to Reproduce

  1. Enable the Telegram plugin globally:

``json
// ~/.claude/settings.json
{
"enabledPlugins": {
"telegram@claude-plugins-official": true
}
}
``

  1. Open two or more Claude Code sessions (e.g., in separate tmux windows):

``bash
# Window 1
claude --channels plugin:telegram@claude-plugins-official
# Window 2
claude --continue
``

  1. Each session spawns its own bun run ... telegram ... start process.
  2. Send messages from Telegram to the bot.

Expected Behavior

  • Only one bot process should poll getUpdates for a given bot token at any time.
  • Sessions without --channels should not spawn a Telegram bot process.
  • Alternatively, a warning should be shown when multiple sessions would compete for the same bot token.

Actual Behavior

  • Each session spawns its own Telegram bot process (bun run --cwd .../telegram --shell=bun --silent start).
  • Multiple processes call getUpdates on the same bot token concurrently.
  • Telegram's Bot API delivers each update to only one consumer — whichever polls first gets the message, the others miss it.
  • Result: messages are silently lost. The user has to send the same message multiple times before it reaches the intended session.
  • Confirmed via ps aux: 2–3 bun ... telegram ... start processes running simultaneously on different TTYs.

Workaround

Install the Telegram plugin at project scope instead of global scope. This ensures only the specific project directory spawns a bot process:

# In the project directory that uses --channels
/plugin install telegram

This prevents other Claude Code sessions from spawning competing bot processes.

Environment

  • Claude Code version: 2.1.92
  • OS: macOS (Darwin 25.5.0)
  • Terminal multiplexer: tmux
  • Plugin: telegram@claude-plugins-official v0.0.4

Suggested Fix

One or more of the following:

  1. Only spawn the Telegram bot process in sessions that use --channels, not in every session that has the plugin enabled.
  2. Use a lock file (e.g., ~/.claude/channels/telegram/polling.lock) to prevent multiple bot processes from polling the same token concurrently.
  3. Warn the user at startup if another process is already polling the same bot token.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗