Skip to content

Telegram gateway adapter times out connecting for valid bot tokens (Lynn/Stephen profiles) #46298

Closed
hashbender/hermes-agent
#263

Description

@lgscablecare

Bug: Telegram gateway adapter fails to connect for some valid bot tokens

Environment

Reproduction

  1. Created 3 persona profiles under ~/.hermes/profiles/: grace, lynn, stephen
  2. Each profile has:
    • Valid Telegram bot token (verified via curl https://api.telegram.org/bot<token>/getMe)
    • GATEWAY_ALLOW_ALL_USERS=true in .env
    • Persona middleware configured (persona.active_persona, external_middleware_url)
  3. Grace connects and works correctly in group chat -5338831834
  4. Lynn and Stephen both fail with identical timeout error

Expected Behavior

Gateway initializes Telegram adapter and connects within ~5 seconds, same as Grace.

Actual Behavior

ERROR gateway.run: ✗ telegram error: telegram connect timed out after 30s
WARNING gateway.run: No adapter could be created for any of the 1 configured platform(s)

The gateway process starts, but the Telegram adapter never establishes a connection.

Evidence

Grace (working):

  • Token: 8652118103:*** (46 chars)
  • Status: Connects successfully, responds in group
  • .env has TELEGRAM_HOME_CHANNEL=8948173366

Lynn (failing):

  • Token: 8819007439:*** (46 chars, pure ASCII)
  • curl getMe returns valid user object
  • .env has TELEGRAM_HOME_CHANNEL=8948173366 (added as workaround)
  • Status: telegram connect timed out after 30s

Stephen (failing):

  • Token: 8845420023:*** (46 chars, pure ASCII)
  • curl getMe returns valid user object
  • .env has TELEGRAM_HOME_CHANNEL=8948173366 (added as workaround)
  • Status: telegram connect timed out after 30s

Configuration (identical pattern across all three)

# config.yaml
model:
  default: gemma3:4b
  provider: ollama
providers:
  ollama:
    host: http://localhost:11434
persona:
  active_persona: <profile>-v1
  disable_external_middleware: false
  external_middleware_url: http://localhost:8100
gateway:
  platforms:
    telegram:
      enabled: true
# .env (all three profiles)
TELEGRAM_BOT_TOKEN=<valid...>
GATEWAY_ALLOW_ALL_USERS=true
TELEGRAM_HOME_CHANNEL=8948173366

Logs

ERROR gateway.run: ✗ telegram error: telegram connect timed out after 30s
WARNING gateway.run: No adapter could be created for any of the 1 configured platform(s)
WARNING gateway.run: Gateway started with no connected platforms
WARNING gateway.run: Reconnect telegram error: telegram connect timed out after 30s, next retry in 60s

Workaround

Grace profile works identically with the same config pattern. The difference appears to be internal to the Telegram client initialization for certain bot tokens or profile configurations.

Suggested Investigation

  • Telegram client adapter initialization in gateway/telegram.py or equivalent
  • Why getMe succeeds via direct curl but adapter connect times out
  • Difference in initialization path between working (Grace) and failing (Lynn/Stephen) profiles

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    comp/gatewayGateway runner, session dispatch, delivery
    on Jun 14, 2026
  2. added 2 commits that reference this issue on Jul 1, 2026
    f84c1b3
    3362bdb
  3. added a commit that references this issue on Jul 2, 2026
    747f563
  4. added a commit that references this issue on Jul 5, 2026
    6e7f8b3
  5. added a commit that references this issue on Jul 8, 2026
    51ef8f3
  6. added a commit that references this issue on Jul 13, 2026
    aec2af1
  7. added a commit that references this issue on Jul 21, 2026
    391efaa
  8. added a commit that references this issue on Aug 7, 2026
    60a4db6
  9. added a commit that references this issue on Sep 3, 2026
    73bf0be
  10. added a commit that references this issue on Oct 6, 2026
    edfc40c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adaptertype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions