openclaw - 💡(How to fix) Fix Migration: rsync silently strips TELEGRAM_BOT_TOKEN/DISCORD_BOT_TOKEN from .env [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#74298Fetched 2026-04-30 06:25:57
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Timeline (top)
cross-referenced ×2commented ×1

When migrating OpenClaw workspace with rsync and standard exclude patterns like --exclude='*.log' --exclude='.cache/', the .env file is copied but critical tokens are silently stripped during the transfer.

Specifically:

  • TELEGRAM_BOT_TOKEN (removed)
  • DISCORD_BOT_TOKEN (removed)
  • Other secrets in .env (preserved)

Root Cause

Root Cause Hypothesis

Fix Action

Workaround

After any rsync migration, verify .env integrity:

ssh target 'cat ~/.openclaw/.env | grep -E "TELEGRAM_BOT_TOKEN|DISCORD_BOT_TOKEN"'

If missing, manually add them from source.

Code Example

TELEGRAM_BOT_TOKEN=7123456789:AAH...
   DISCORD_BOT_TOKEN=MTI...
   ANTHROPIC_API_KEY=sk-ant-...
   BACKUP_PASSPHRASE=...

---

rsync -avz --exclude='.git/objects/*' --exclude='node_modules/' \
         ~/.openclaw/ user@target:~/.openclaw/

---

grep TELEGRAM_BOT_TOKEN ~/.openclaw/.env  # Empty
   grep ANTHROPIC_API_KEY ~/.openclaw/.env   # Present

---

ssh target 'cat ~/.openclaw/.env | grep -E "TELEGRAM_BOT_TOKEN|DISCORD_BOT_TOKEN"'
RAW_BUFFERClick to expand / collapse

Migration: rsync excludes TELEGRAM_BOT_TOKEN and DISCORD_BOT_TOKEN from .env when using standard patterns

Environment

  • OpenClaw Version: 2026.4.24–2026.4.26
  • Migration Context: BLUE/GREEN VPS deployment (Ubuntu 24.04 → Ubuntu 26.04)
  • Tool: rsync with standard exclude patterns

Summary

When migrating OpenClaw workspace with rsync and standard exclude patterns like --exclude='*.log' --exclude='.cache/', the .env file is copied but critical tokens are silently stripped during the transfer.

Specifically:

  • TELEGRAM_BOT_TOKEN (removed)
  • DISCORD_BOT_TOKEN (removed)
  • Other secrets in .env (preserved)

Steps to Reproduce

  1. Source .env contains:

    TELEGRAM_BOT_TOKEN=7123456789:AAH...
    DISCORD_BOT_TOKEN=MTI...
    ANTHROPIC_API_KEY=sk-ant-...
    BACKUP_PASSPHRASE=...
  2. Run standard rsync:

    rsync -avz --exclude='.git/objects/*' --exclude='node_modules/' \
          ~/.openclaw/ user@target:~/.openclaw/
  3. On target, .env is present but:

    grep TELEGRAM_BOT_TOKEN ~/.openclaw/.env  # Empty
    grep ANTHROPIC_API_KEY ~/.openclaw/.env   # Present

Root Cause Hypothesis

Rsync may have a built-in filter or the exclude pattern interacts unexpectedly with token line formats. Alternatively, the .env file may have been manually edited on the target after the rsync, and the issue was attributed to rsync incorrectly.

Expected Behavior

All secrets in .env should transfer intact during rsync.

Actual Behavior

Telegram and Discord bot tokens were missing post-rsync, requiring manual re-addition.

Impact

  • Gateway started but Telegram plugin failed silently (no polling, no errors logged)
  • Discovery only happened during end-to-end testing (~1h after cutover attempt)
  • Rollback was triggered due to non-functional Telegram integration

Workaround

After any rsync migration, verify .env integrity:

ssh target 'cat ~/.openclaw/.env | grep -E "TELEGRAM_BOT_TOKEN|DISCORD_BOT_TOKEN"'

If missing, manually add them from source.

Request

  1. Investigate if rsync + OpenClaw has known issues with .env token formats
  2. Add a pre-flight check in openclaw doctor to validate .env contains expected keys
  3. Document .env migration best practices in DR/migration guides

Evidence: Production incident during VPS migration (2026-04-28), documented in docs/dr/migration-lessons-2026-04-28.md

extent analysis

TL;DR

Manually verify and restore TELEGRAM_BOT_TOKEN and DISCORD_BOT_TOKEN in the .env file after rsync migration as a workaround.

Guidance

  • Investigate rsync command and patterns for potential interactions with .env file formatting that might cause token removal.
  • Add a pre-flight check in openclaw doctor to ensure .env contains expected keys like TELEGRAM_BOT_TOKEN and DISCORD_BOT_TOKEN.
  • Document best practices for .env migration in disaster recovery and migration guides to prevent future occurrences.
  • Consider using a more explicit include pattern for the .env file in rsync commands to ensure its contents are preserved.

Example

No code snippet is provided as the issue seems related to the interaction between rsync patterns and the .env file format rather than a code-level problem.

Notes

The root cause of the issue is not definitively identified, and it's unclear if the problem lies with rsync, the exclude patterns used, or another factor. Therefore, the suggested steps are precautionary and aimed at mitigating the observed behavior.

Recommendation

Apply the workaround of manually verifying and restoring TELEGRAM_BOT_TOKEN and DISCORD_BOT_TOKEN after rsync migration until a more definitive solution or root cause is identified. This ensures critical services like the Telegram plugin remain functional post-migration.

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 Migration: rsync silently strips TELEGRAM_BOT_TOKEN/DISCORD_BOT_TOKEN from .env [1 comments, 2 participants]