#double message telegram

1 messages Β· Page 1 of 1 (latest)

meager heart
#

Help double messages on telegram from the bot! Revoked API key. Hard kill daemon restart everything bunch of times. Still getting it. Only polling no webhook. Strange.

spare flintBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

deft pulsarBOT
# meager heart Help double messages on telegram from the bot! Revoked API key. Hard kill daemon...

Based on my knowledge of Clawdbot and Telegram polling issues, here are the most likely causes and fixes for double messages:

Common Causes & Solutions

1. Two Bot Instances Running (Most Common)

Even after hard kill, a process might still be hanging.

# Check for any clawdbot/telegram processes
ps aux | grep -i clawdbot
ps aux | grep -i telegram

# Check for processes on your telegram port
lsof -i :18789

# Kill any lingering processes
#
pkill -9 -f clawdbot
pkill -9 -f telegram

2. Polling Offset Issue

When using polling, the offset might not be advancing properly. Check your gateway logs:

clawdbot logs --follow | grep -i "telegram\|polling\|offset"

3. State/Cache Corruption

Try clearing the state files:

#
# Clear any Telegram-related state
rm -rf ~/.clawdbot/state/telegram*
rm -rf ~/.clawdbot/cache/telegram*

# Restart fresh
clawdbot daemon restart

4. Update to Latest Version

There was a recent update that improved Telegram message handling:

cd ~/clawdbot-ref && git pull
clawdbot update
clawdbot daemon restart
#

5. Check Configuration

Make sure you're not accidentally running both polling and webhook simultaneously (even if webhook is "disabled", there could be a config conflict):

clawdbot config get telegram

Try this sequence:

  1. Full daemon stop: clawdbot daemon stop
  2. pkill -9 -f clawdbot
  3. Clear cache/state as above
  4. clawdbot daemon start
  5. Watch logs: clawdbot logs --follow

If it persists after all that, share the relevant log output when the duplicate occurs β€” the process message entries will show if it's being handled twice.

sterile dragon
#

altually repToMode: off

deft pulsarBOT
# sterile dragon altually repToMode: off

With replyToMode: off, double messages are usually caused by one of these:

Quick Fixes to Try

1. Update to Latest (there were telegram refactors Jan 14):

cd ~/clawdbot-ref && git pull
clawdbot update
clawdbot daemon restart

2. Check your actual running version:

clawdbot --version

3. Look at the logs right when it happens:

#
clawdbot logs --follow | grep -E "process message|dispatch|chatId=${your_chat_id}"

The process message logs should show if the same message is being handled twice. If you see two process message dispatching entries for the same messageId, it's a handler issue. If you see two process message complete entries, something's triggering two dispatches.


What to share:

  • Output of clawdbot --version
  • The log lines around the duplicate (look for same messageId or chatId)
  • Your telegram config: clawdbot config get telegram

This will help identify if it's the Jan 14 handler refactor issue or something else. The recent diagnostic logging changes (bot-message.ts) should help pinpoint exactly where the duplicate originates.

meager heart
deft pulsarBOT
# meager heart Is this the solution

Based on my knowledge and previous support cases, repToMode: off can help with double messages in Telegram, but it's not always the complete solution. Here's what's going on:

What repToMode: off does:
It disables the "reply to" formatting in Telegram messages. When enabled, Clawdbot tries to create threaded replies, which can sometimes cause duplicates or formatting issues.

Common causes of double messages:

  1. Streaming mode race conditions - The most frequent culprit. Set streamMode: "off" in your Telegram config:
    {
      "channels": {
        "telegram": {
          "streamMode": "off"
        }
      }
    }
    
#
  1. Multiple polling instances - Make sure you don't have two clawdbot processes running

  2. API key issues - Since you already revoked and restarted, this should be cleared

Try this:

{
  "channels": {
    "telegram": {
      "streamMode": "off",
      "repToMode": "off"
    }
  }
}

If that doesn't fix it, check the FAQ for more troubleshooting: https://docs.clawd.bot/start/faq#telegram-block-streaming-isnt-

#

Did repToMode: off resolve it for you? 🦐

meager heart
#

no it didn't resolve it for me

deft pulsarBOT
# meager heart no it didn't resolve it for me

No specific Telegram double-message issue found in GitHub issues. This could be a few things:

Things to check:

  1. Are you on the latest version? Some fixes landed recently:

    clawdbot --version
    cd ~/clawdbot-ref && git pull && pnpm install && pnpm build
    
  2. Check your logs for patterns:

    clawdbot logs --follow | grep -i "telegram\|message\|duplicate"
    

    Look for any repeated update_id patterns or message processing logs.

  3. Possible causes for Telegram polling doubles:

#
  • GrammY runner not properly committing the polling offset between message batches
    • Multiple gateway instances picking up the same updates
    • A race condition in message acknowledgment

Quick things to try:

  • Make sure only ONE gateway process is running
  • Try setting channels.telegram.allowedUpdates: ["message"] (narrower than default) to see if it helps
  • Check clawdbot channels status --probe to verify channel health

If this started recently after an update, it might be worth opening a GitHub issue with your logs. Can you share what version you're running and any relevant log snippets?

sterile dragon
deft pulsarBOT
# sterile dragon i think gateway cache old data

Based on the code and memory, here's what's likely happening and how to fix it:

The Problem

Telegram polling relies on an offset file (~/.clawdbot/state/telegram/update-offset-${account}.json) to track which updates have been processed. If this file gets corrupted or the gateway has stale state, it can reprocess old updates β†’ double messages.

Quick Fixes to Try

  1. Clear the offset file manually:

    rm -f ~/.clawdbot/state/telegram/update-offset-*.json
    clawdbot gateway restart
    
  2. Check for multiple instances:

#
   clawdbot gateway status
   # If already running, stop it first
   clawdbot gateway stop
   # Then restart
   clawdbot gateway start
  1. Wipe Telegram state completely (nuclear option):

    rm -rf ~/.clawdbot/state/telegram/
    clawdbot gateway restart
    
  2. Check logs for offset-related errors: