Skip to content

[Bug] MessageChannel tool adds extra quotes to chat_id, causing 'No route for chat_id' error on Telegram #2279

@dalecaru

Description

@dalecaru

Bug Description

The MessageChannel tool adds extra quotes around the chat_id parameter when sending messages to Telegram, causing a No route for chat_id error. The error message shows ""<chat_id>"" instead of "<chat_id>".

Steps to Reproduce

  1. Set up a Telegram channel with Letta Code (desktop app v0.24.13 on macOS)
  2. Configure routing and accounts in ~/.letta/channels/telegram/
  3. Receive a message from Telegram (works fine — messages arrive via channel-notification)
  4. Try to reply using the MessageChannel tool:
    MessageChannel(action="send", channel="telegram", chat_id="<numeric_chat_id>", message="Hello")
    
  5. Error: No route for chat_id ""<numeric_chat_id>"" on "telegram" for this agent/conversation.

Expected Behavior

The MessageChannel tool should pass chat_id as "<numeric_chat_id>" to the routing system, matching the route configured in routing.yaml.

Actual Behavior

The chat_id gets double-quoted somewhere in the tool → routing pipeline, resulting in ""<numeric_chat_id>"", which doesn't match any route.

Workaround

Sending messages directly via the Telegram Bot API (curl to sendMessage endpoint) works correctly with the same chat_id.

Environment

  • Letta Code: 0.24.13 (desktop app on macOS)
  • Channel: Telegram
  • Config: dmPolicy: "allowlist", allowedUsers: ["<numeric_chat_id>"], routing.yaml has chatId: "<numeric_chat_id>"
  • The route exists and is enabled — inbound messages work fine, only outbound via MessageChannel fails

Additional Context

The routing config is correct. The issue is specifically in how the MessageChannel tool serializes/passes the chat_id parameter to the routing lookup. This appears to be a string quoting/escaping bug in the tool implementation.

Related: PR #1737 (channels system with Telegram MVP), PR #1763 (Slack adapter and target binding — modified MessageChannel.ts)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions