openclaw - 💡(How to fix) Fix [BUG] Gateway crashes every few minutes with unhandled promise rejection [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#62945Fetched 2026-04-09 08:00:21
View on GitHub
Comments
1
Participants
1
Timeline
1
Reactions
1
Participants
Timeline (top)
commented ×1

Error Message

Error: Agent listener invoked outside active run at Agent.processEvents (pi-agent-core/src/agent.ts:533:10) at Object.onUpdate (agent-loop.ts:539:7) at emitUpdate (exec-defaults-uj0McX2k.js:1524:8) at handleStdout (exec-defaults-uj0McX2k.js:1546:4) at Object.onSupervisorStdout [as onStdout] (exec-defaults-uj0McX2k.js:1610:3)

Process receives SIGKILL immediately after this error.

RAW_BUFFERClick to expand / collapse

Bug Description

Gateway crashes with unhandled promise rejection causing repeated crashes every few minutes. All long-running commands are killed by SIGKILL when the gateway crashes.

Error

Error: Agent listener invoked outside active run at Agent.processEvents (pi-agent-core/src/agent.ts:533:10) at Object.onUpdate (agent-loop.ts:539:7) at emitUpdate (exec-defaults-uj0McX2k.js:1524:8) at handleStdout (exec-defaults-uj0McX2k.js:1546:4) at Object.onSupervisorStdout [as onStdout] (exec-defaults-uj0McX2k.js:1610:3)

Process receives SIGKILL immediately after this error.

Environment

  • OpenClaw version: v2026.4.5
  • Node.js version: v24.14.1
  • OS: Windows (64-bit)

Steps to Reproduce

  1. Start OpenClaw gateway
  2. Execute long-running commands or spawn subagent sessions
  3. Wait 2-10 minutes
  4. Gateway crashes
  5. System auto-restarts but crash cycle repeats

Frequency

Crash occurs repeatedly, approximately every 5-7 minutes.

Impact

  • Gateway becomes unavailable
  • All active sessions and commands are terminated
  • Cannot execute any SSH commands or long-running tasks
  • Crash cycle repeats indefinitely

Expected Behavior

Gateway should handle agent lifecycle properly without throwing unhandled promise rejections.

extent analysis

TL;DR

The gateway crash due to an unhandled promise rejection may be resolved by addressing the Agent listener invoked outside active run error, potentially by ensuring proper agent lifecycle management.

Guidance

  • Investigate the Agent.processEvents function in pi-agent-core/src/agent.ts to understand why the agent listener is being invoked outside an active run.
  • Review the error stacktrace to identify the sequence of events leading to the error, focusing on the interaction between agent-loop.ts, exec-defaults-uj0McX2k.js, and the supervisor stdout handling.
  • Consider implementing error handling for the Agent listener invoked outside active run error to prevent the unhandled promise rejection and subsequent gateway crash.
  • Examine the OpenClaw configuration and Node.js environment to ensure that there are no resource constraints or configuration issues contributing to the crash.

Example

No code snippet is provided due to the lack of specific implementation details in the issue.

Notes

The root cause of the issue is unclear, and further investigation is required to determine the exact reason for the Agent listener invoked outside active run error. The provided guidance is based on the information available in the issue.

Recommendation

Apply a workaround to handle the Agent listener invoked outside active run error and prevent the unhandled promise rejection, as the root cause of the issue is not immediately clear.

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 [BUG] Gateway crashes every few minutes with unhandled promise rejection [1 comments, 1 participants]