openclaw - 💡(How to fix) Fix Telegram /restart command: "You are not authorized" despite sender in commands.allowFrom [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77113Fetched 2026-05-05 05:52:01
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

Root Cause

  • commands.allowFrom.telegram is configured → commandsAllowFromConfigured = true
  • resolveCommandAuthorization() is called → resolveCommandsAllowFromList() resolves to [\"8601703373\"]
  • resolveSenderCandidates() produces sender candidates from Telegram msg.from.id (8601703373)
  • BUT resolveCommandSenderAuthorization() checks commandsAllowFromConfigured && !providerResolutionError first, and requires an exact match in commandsAllowFromList
  • The matching appears to fail silently, resulting in isAuthorizedSender: false
  • The "not authorized" rejection happens in bot-gUR32RLX.js:rejectNotAuthorized() → called when requireAuth && !commandAuthorized

Code Example

{
  \"allowFrom\": [\"8601703373\"],
  \"commands\": {
    \"allowFrom\": {
      \"telegram\": [\"8601703373\"]
    },
    \"ownerAllowFrom\": [\"8601703373\"],
    \"restart\": true
  },
  \"channels\": {
    \"telegram\": {
      \"allowFrom\": [\"8601703373\"],
      \"dmPolicy\": \"pairing\"
    }
  }
}

---

{\"version\": 1, \"allowFrom\": [\"8601703373\", \"8641935340\"]}
RAW_BUFFERClick to expand / collapse

Bug Description

Telegram DM from an authorized sender (8601703373, listed in credentials/telegram-default-allowFrom.json) fails with "You are not authorized to use this command." when running /restart.

The same sender is already in credentials/telegram-default-allowFrom.json which works for session routing, but NOT for native command authorization.

Steps to Reproduce

  1. Set up Telegram bot with dmPolicy: \"pairing\"
  2. Pair/authorize a sender (sender ID appears in credentials/telegram-default-allowFrom.json)
  3. Send /restart command in Telegram DM
  4. Bot responds: "You are not authorized to use this command."

Config Used

{
  \"allowFrom\": [\"8601703373\"],
  \"commands\": {
    \"allowFrom\": {
      \"telegram\": [\"8601703373\"]
    },
    \"ownerAllowFrom\": [\"8601703373\"],
    \"restart\": true
  },
  \"channels\": {
    \"telegram\": {
      \"allowFrom\": [\"8601703373\"],
      \"dmPolicy\": \"pairing\"
    }
  }
}

Sender also confirmed in credentials/telegram-default-allowFrom.json:

{\"version\": 1, \"allowFrom\": [\"8601703373\", \"8641935340\"]}

Expected Behavior

/restart should execute for authorized sender (same sender works fine for regular chat sessions).

Analysis

  • commands.allowFrom.telegram is configured → commandsAllowFromConfigured = true
  • resolveCommandAuthorization() is called → resolveCommandsAllowFromList() resolves to [\"8601703373\"]
  • resolveSenderCandidates() produces sender candidates from Telegram msg.from.id (8601703373)
  • BUT resolveCommandSenderAuthorization() checks commandsAllowFromConfigured && !providerResolutionError first, and requires an exact match in commandsAllowFromList
  • The matching appears to fail silently, resulting in isAuthorizedSender: false
  • The "not authorized" rejection happens in bot-gUR32RLX.js:rejectNotAuthorized() → called when requireAuth && !commandAuthorized

Possible Cause

The issue may be in how normalizeAllowFromEntry() / formatAllowFromList() processes the sender ID when comparing against commandsAllowFromList. The Telegram sender ID (8601703373 as a numeric string) may not be matching the configured list entry despite appearing identical.

extent analysis

TL;DR

The issue can be fixed by ensuring the sender ID in commands.allowFrom.telegram is formatted correctly to match the Telegram sender ID.

Guidance

  • Verify that the normalizeAllowFromEntry() function is correctly processing the sender ID as a numeric string.
  • Check the formatAllowFromList() function to ensure it is not modifying the sender ID in a way that prevents matching.
  • Compare the output of resolveCommandsAllowFromList() with the actual sender ID from Telegram to identify any formatting discrepancies.
  • Consider adding logging or debugging statements to resolveCommandSenderAuthorization() to understand why the matching is failing.

Example

No code snippet is provided as the issue is related to the comparison of sender IDs and requires further investigation into the normalizeAllowFromEntry() and formatAllowFromList() functions.

Notes

The issue may be due to a subtle difference in formatting between the configured sender ID and the actual Telegram sender ID, which is not immediately apparent from the provided configuration files.

Recommendation

Apply a workaround by manually verifying the formatting of the sender ID in commands.allowFrom.telegram to ensure it matches the Telegram sender ID, as the root cause of the issue is likely related to the processing of the sender ID.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Telegram /restart command: "You are not authorized" despite sender in commands.allowFrom [1 comments, 2 participants]