openclaw - ✅(Solved) Fix Health-monitor causes gateway crash: TypeError Cannot read properties of undefined (reading 'info') [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

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#66681Fetched 2026-04-15 06:24:59
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1referenced ×1

When the health-monitor attempts to restart a channel that has stopped, it crashes the gateway with an unhandled promise rejection.

Error Message

[openclaw] Unhandled promise rejection: TypeError: Cannot read properties of undefined (reading 'info') at file:///.../server.impl-BbJvXoPb.js:2548:10 at processTicksAndRejections (node:internal/process/task_queues:104:5)

Root Cause

In server.impl-BbJvXoPb.js:2548:

const log = channelLogs[channelId];
// ...
log.info?.(`[${id}] auto-restart attempt...`);

When channelLogs[channelId] is undefined, log is undefined. Accessing log.info throws an error.

The optional chaining log.info?.() only protects against info being undefined, not log itself.

Correct fix:

log?.info?.(`[${id}] auto-restart attempt...`);

Fix Action

Workaround

Disable health-monitor for the affected channel:

"channels": {
  "mychannel": {
    "healthMonitor": {
      "enabled": false
    }
  }
}

PR fix notes

PR #66726: fix: guard against undefined channel log in health-monitor restart

Description (problem / solution / changelog)

Summary

Guard against undefined channelLogs[channelId] in health-monitor restart and shutdown logic, preventing gateway crash when restarting custom channel plugins.

Root Cause

When channelLogs[channelId] is undefined (e.g., for custom channel plugins that have not yet registered their logger), direct log.info?.() calls crash with TypeError: Cannot read properties of undefined (reading 'info'). The optional chaining log.info?.() only protects against info being undefined, not log itself.

Fix

Added optional chaining on the log object at all 6 call sites: log?.error?.(), log?.info?.(), log?.warn?.().

Test Plan

  • Gateway health-monitor restart logic no longer crashes when channelLogs entry is missing
  • Existing unit tests pass

Closes openclaw#66681

Changed files

  • src/gateway/server-channels.ts (modified, +6/-6)

Code Example

[openclaw] Unhandled promise rejection: TypeError: Cannot read properties of undefined (reading 'info')
    at file:///.../server.impl-BbJvXoPb.js:2548:10
    at processTicksAndRejections (node:internal/process/task_queues:104:5)

---

const log = channelLogs[channelId];
// ...
log.info?.(`[${id}] auto-restart attempt...`);

---

log?.info?.(`[${id}] auto-restart attempt...`);

---

"channels": {
  "mychannel": {
    "healthMonitor": {
      "enabled": false
    }
  }
}
RAW_BUFFERClick to expand / collapse

Summary

When the health-monitor attempts to restart a channel that has stopped, it crashes the gateway with an unhandled promise rejection.

Expected Behavior

The health-monitor should handle missing log objects gracefully and not crash the gateway.

Actual Behavior

Gateway crashes with:

[openclaw] Unhandled promise rejection: TypeError: Cannot read properties of undefined (reading 'info')
    at file:///.../server.impl-BbJvXoPb.js:2548:10
    at processTicksAndRejections (node:internal/process/task_queues:104:5)

Root Cause

In server.impl-BbJvXoPb.js:2548:

const log = channelLogs[channelId];
// ...
log.info?.(`[${id}] auto-restart attempt...`);

When channelLogs[channelId] is undefined, log is undefined. Accessing log.info throws an error.

The optional chaining log.info?.() only protects against info being undefined, not log itself.

Correct fix:

log?.info?.(`[${id}] auto-restart attempt...`);

Reproduction Steps

  1. Create a custom channel plugin with a simple startAccount that returns { stop: () => {} }
  2. The health-monitor detects the channel as "stopped"
  3. Health-monitor attempts to restart the channel
  4. Gateway crashes with the TypeError

Workaround

Disable health-monitor for the affected channel:

"channels": {
  "mychannel": {
    "healthMonitor": {
      "enabled": false
    }
  }
}

Environment

  • OpenClaw version: v2026.4.14
  • Node.js: v24.14.0
  • OS: WSL2 (Ubuntu on Windows)

Related Code Locations

  • server.impl-BbJvXoPb.js:2548 - The problematic line
  • server.impl-BbJvXoPb.js:2434 - Where log is assigned from channelLogs[channelId]
  • server.impl-BbJvXoPb.js:17297 - Health-monitor restart logic

extent analysis

TL;DR

Update the problematic line in server.impl-BbJvXoPb.js to use optional chaining for both log and info to prevent the TypeError.

Guidance

  • Verify that the issue is indeed caused by the missing log object by checking if channelLogs[channelId] is undefined before attempting to access its properties.
  • Apply the correct fix by changing the line to log?.info?.([${id}] auto-restart attempt...); to handle cases where log is undefined.
  • As a temporary workaround, consider disabling the health-monitor for the affected channel by setting "healthMonitor": { "enabled": false } in the channel configuration.
  • Review the health-monitor restart logic in server.impl-BbJvXoPb.js:17297 to ensure it properly handles missing log objects.

Example

// Corrected line
log?.info?.(`[${id}] auto-restart attempt...`);

Notes

This fix assumes that the log object is expected to be optional and that the code should not crash when it is missing. If the log object is required, additional error handling may be necessary.

Recommendation

Apply the workaround by disabling the health-monitor for the affected channel until the correct fix can be implemented, as it provides a safe and immediate solution to prevent gateway crashes.

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 - ✅(Solved) Fix Health-monitor causes gateway crash: TypeError Cannot read properties of undefined (reading 'info') [1 pull requests, 1 participants]