[BUG] Telegram plugin: globally-enabled plugin spawns duplicate bot processes across sessions, causing message loss
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
- Enable the Telegram plugin globally:
``json``
// ~/.claude/settings.json
{
"enabledPlugins": {
"telegram@claude-plugins-official": true
}
}
- 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
- Each session spawns its own
bun run ... telegram ... startprocess. - Send messages from Telegram to the bot.
Expected Behavior
- Only one bot process should poll
getUpdatesfor a given bot token at any time. - Sessions without
--channelsshould 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
getUpdateson 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–3bun ... telegram ... startprocesses 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-officialv0.0.4
Suggested Fix
One or more of the following:
- Only spawn the Telegram bot process in sessions that use
--channels, not in every session that has the plugin enabled. - Use a lock file (e.g.,
~/.claude/channels/telegram/polling.lock) to prevent multiple bot processes from polling the same token concurrently. - Warn the user at startup if another process is already polling the same bot token.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗