openclaw - 💡(How to fix) Fix Discord/Telegram channels silently fail to initialize under LaunchAgent after restart [1 comments, 1 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#58064Fetched 2026-04-08 01:54:16
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
commented ×1

When the OpenClaw gateway runs as a macOS LaunchAgent, Discord and Telegram channels silently fail to initialize after the first process lifecycle. The gateway starts, listens on the configured port, and reports channels as "ON / OK" in openclaw status, but no channel provider startup occurs (no [discord] starting provider or [telegram] starting provider in logs). Running the same binary in the foreground (node ... gateway --port 18789) initializes channels correctly every time.

Error Message

The issue appears related to the LaunchAgent process lifecycle. The first boot works, suggesting initial state is clean. After any restart, some internal state prevents channel initialization without logging any error. The fact that openclaw status reports channels as OK while they're not initialized makes this harder to diagnose.

Root Cause

When the OpenClaw gateway runs as a macOS LaunchAgent, Discord and Telegram channels silently fail to initialize after the first process lifecycle. The gateway starts, listens on the configured port, and reports channels as "ON / OK" in openclaw status, but no channel provider startup occurs (no [discord] starting provider or [telegram] starting provider in logs). Running the same binary in the foreground (node ... gateway --port 18789) initializes channels correctly every time.

Fix Action

Fix / Workaround

Workaround: Stop the LaunchAgent and run the gateway in the foreground:

openclaw gateway stop
/usr/local/bin/node /usr/local/lib/node_modules/openclaw/dist/index.js gateway --port 18789

Code Example

[plugins] openclaw-mem0: registered ...
[telegram] [default] starting provider (@claw_for_jinseok_bot)
[discord] [default] Discord Message Content Intent is limited...
[discord] [default] starting provider (@Openclaw Clawdy)
[discord] channels resolved: guild:...
[discord] client initialized as ... ; awaiting gateway readiness

---

[plugins] openclaw-mem0: registered ...
[canvas] host mounted at ...
[heartbeat] started
[health-monitor] started ...
[gateway] agent model: anthropic/claude-opus-4-6
[gateway] listening on ws://127.0.0.1:18789 (PID ...)

---

[discord] [default] starting provider (@Openclaw Clawdy)
[telegram] [default] starting provider (@claw_for_jinseok_bot)
[discord] client initialized...

---

openclaw gateway stop
/usr/local/bin/node /usr/local/lib/node_modules/openclaw/dist/index.js gateway --port 18789
RAW_BUFFERClick to expand / collapse

Bug Report: Discord/Telegram channels silently fail to initialize under LaunchAgent

Bug type

Bug (channels work in foreground, silently skip under LaunchAgent)

Summary

When the OpenClaw gateway runs as a macOS LaunchAgent, Discord and Telegram channels silently fail to initialize after the first process lifecycle. The gateway starts, listens on the configured port, and reports channels as "ON / OK" in openclaw status, but no channel provider startup occurs (no [discord] starting provider or [telegram] starting provider in logs). Running the same binary in the foreground (node ... gateway --port 18789) initializes channels correctly every time.

Steps to reproduce

  1. Have OpenClaw gateway running as a LaunchAgent on macOS with Discord and Telegram channels configured and working
  2. Trigger any restart (SIGUSR1 via gateway tool, openclaw gateway restart, openclaw gateway stop && openclaw gateway start, or launchctl kickstart -k)
  3. Gateway comes back up (new PID, listening on port, webchat works)
  4. Discord and Telegram channels never start — no [discord] or [telegram] log entries at all
  5. openclaw status still shows both channels as ON / OK
  6. Sending messages via the message tool returns "Channel is unavailable: discord"

Expected behavior

Channels initialize on every gateway start, regardless of whether it runs under LaunchAgent or in the foreground.

Actual behavior

  • First boot of the day (LaunchAgent): Channels start correctly. Logs show [discord] [default] starting provider (@BotName) and [telegram] [default] starting provider (@bot_name).
  • Every subsequent restart (LaunchAgent): Channels silently skip initialization. No Discord/Telegram log entries at all. No errors logged.
  • Foreground run: Always works. Channels initialize every time.

Evidence

Working boot (first LaunchAgent start, 10:35 KST):

[plugins] openclaw-mem0: registered ...
[telegram] [default] starting provider (@claw_for_jinseok_bot)
[discord] [default] Discord Message Content Intent is limited...
[discord] [default] starting provider (@Openclaw Clawdy)
[discord] channels resolved: guild:...
[discord] client initialized as ... ; awaiting gateway readiness

Broken boot (LaunchAgent restart, 10:58+ KST):

[plugins] openclaw-mem0: registered ...
[canvas] host mounted at ...
[heartbeat] started
[health-monitor] started ...
[gateway] agent model: anthropic/claude-opus-4-6
[gateway] listening on ws://127.0.0.1:18789 (PID ...)

No Discord or Telegram lines at all. Gateway is running and serving webchat, but channels are completely absent.

Foreground run (same config, same machine, 11:12 KST):

[discord] [default] starting provider (@Openclaw Clawdy)
[telegram] [default] starting provider (@claw_for_jinseok_bot)
[discord] client initialized...

Works perfectly every time.

Debugging performed

  • Config validated: channels.discord.enabled=true, channels.telegram.enabled=true, tokens present and correct format
  • openclaw status shows channels as ON/OK (misleading)
  • openclaw doctor --non-interactive reports no channel issues
  • No OPENCLAW_SKIP_CHANNELS or OPENCLAW_SKIP_PROVIDERS env vars set
  • LaunchAgent plist environment verified via launchctl print — all API keys present
  • Auth profiles (auth-profiles.json) contain valid tokens for all providers
  • Network connectivity works (curl to Discord API returns 200)
  • lsof confirms no outbound connections to Discord/Telegram from the LaunchAgent process
  • Tried: SIGUSR1, SIGTERM, openclaw gateway restart, openclaw gateway stop/start, launchctl kickstart -k, launchctl bootout/bootstrap — all produce the same broken result
  • Only foreground execution works

OpenClaw version

2026.3.28 (f9b1079)

Operating system

macOS 26.3.1 (arm64) — MacBook Pro

Install method

pnpm global

Impact and severity

Severity: High — Discord and Telegram become permanently unreachable after any LaunchAgent restart until the user manually runs the gateway in the foreground.

Affected: macOS LaunchAgent users with Discord/Telegram channels.

Workaround: Stop the LaunchAgent and run the gateway in the foreground:

openclaw gateway stop
/usr/local/bin/node /usr/local/lib/node_modules/openclaw/dist/index.js gateway --port 18789

Additional information

The issue appears related to the LaunchAgent process lifecycle. The first boot works, suggesting initial state is clean. After any restart, some internal state prevents channel initialization without logging any error. The fact that openclaw status reports channels as OK while they're not initialized makes this harder to diagnose.

Possibly related to #40905 (LaunchAgent restart issues) but distinct — in this case the service runs fine, it's specifically the channel providers that silently fail to start.

extent analysis

Fix Plan

To resolve the issue of Discord and Telegram channels silently failing to initialize under LaunchAgent, we need to modify the LaunchAgent configuration and the OpenClaw gateway code.

Step 1: Modify LaunchAgent Configuration

Update the LaunchAgent plist file to include the following configuration:

<key>EnvironmentVariables</key>
<dict>
    <key>OPENCLAW_CHANNEL_INIT</key>
    <string>TRUE</string>
</dict>

This will set an environment variable OPENCLAW_CHANNEL_INIT to TRUE for the LaunchAgent process.

Step 2: Update OpenClaw Gateway Code

Modify the OpenClaw gateway code to check for the OPENCLAW_CHANNEL_INIT environment variable and initialize channels accordingly:

const initChannels = () => {
    // ... existing code ...

    if (process.env.OPENCLAW_CHANNEL_INIT === 'TRUE') {
        // Initialize Discord and Telegram channels
        discordProvider.init();
        telegramProvider.init();
    }
};

Step 3: Handle Restart Scenarios

To handle restart scenarios, add a check to see if the channels are already initialized before attempting to initialize them again:

const initChannels = () => {
    // ... existing code ...

    if (process.env.OPENCLAW_CHANNEL_INIT === 'TRUE' && !channelsInitialized) {
        // Initialize Discord and Telegram channels
        discordProvider.init();
        telegramProvider.init();
        channelsInitialized = true;
    }
};

Verification

To verify that the fix worked, restart the LaunchAgent and check the logs for Discord and Telegram channel initialization messages. You can also use the openclaw status command to check the status of the channels.

Extra Tips

  • Make sure to update the LaunchAgent configuration and restart the service after making changes.
  • If you're using a version control system, commit the changes to the OpenClaw gateway code and update the dependencies accordingly.
  • Consider adding additional logging to help diagnose any future issues with channel initialization.

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…

FAQ

Expected behavior

Channels initialize on every gateway start, regardless of whether it runs under LaunchAgent or in the foreground.

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 Discord/Telegram channels silently fail to initialize under LaunchAgent after restart [1 comments, 1 participants]