openclaw - ✅(Solved) Fix TypeError: undefined is not iterable at notifyActiveTaskWaiters (command-queue) [1 pull requests, 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#61731Fetched 2026-04-08 02:55:17
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

The error occurs during lane task execution, specifically when notifyActiveTaskWaiters is called. It appears to be a null/undefined pointer issue where the code attempts to iterate over a value that is unexpectedly undefined.

The crash causes the gateway to restart, interrupting ongoing conversations and tasks.

Error Message

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) at Array.from (<anonymous>) at notifyActiveTaskWaiters (file:///.../openclaw/dist/command-queue-Cssp02gj.js:88:29) at file:///.../openclaw/dist/command-queue-Cssp02gj.js:130:8

Root Cause

The error occurs during lane task execution, specifically when notifyActiveTaskWaiters is called. It appears to be a null/undefined pointer issue where the code attempts to iterate over a value that is unexpectedly undefined.

The crash causes the gateway to restart, interrupting ongoing conversations and tasks.

Fix Action

Fixed

PR fix notes

PR #61778: fix(command-queue): guard against missing activeTaskWaiters on stale singleton

Description (problem / solution / changelog)

Summary

  • After an in-process restart (SIGUSR1), resolveGlobalSingleton returns the state object from the previous module version which may predate the activeTaskWaiters field. This caused Array.from(undefined) to throw TypeError in notifyActiveTaskWaiters.
  • Added a guard in getQueueState() to initialize activeTaskWaiters as a new Set if missing from the stale singleton.
  • Added ?? [] fallback in notifyActiveTaskWaiters and resetCommandQueueStateForTest as belt-and-suspenders protection.

Test plan

  • Added test: notifyActiveTaskWaiters survives stale singleton without activeTaskWaiters (pre-restart state)
  • Added test: notifyActiveTaskWaiters handles concurrent task completion with multiple waiters
  • All existing command-queue tests continue to pass

Closes #61731

Changed files

  • src/process/command-queue.test.ts (modified, +49/-0)
  • src/process/command-queue.ts (modified, +10/-3)

Code Example

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Array.from (<anonymous>)
    at notifyActiveTaskWaiters (file:///.../openclaw/dist/command-queue-Cssp02gj.js:88:29)
    at file:///.../openclaw/dist/command-queue-Cssp02gj.js:130:8

---

2026-04-06T15:06:15.817+08:00 [diagnostic] lane task error: lane=main durationMs=45187 error="TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))"
2026-04-06T15:06:15.821+08:00 [openclaw] Unhandled promise rejection: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
RAW_BUFFERClick to expand / collapse

Bug Description

Repeated crashes with TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) in the command-queue module.

Error Stack

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
    at Array.from (<anonymous>)
    at notifyActiveTaskWaiters (file:///.../openclaw/dist/command-queue-Cssp02gj.js:88:29)
    at file:///.../openclaw/dist/command-queue-Cssp02gj.js:130:8

Environment

  • OpenClaw Version: 2026.4.5 (3e72c03)
  • Node Version: v24.1.0
  • OS: macOS Darwin 25.4.0 (arm64)

Frequency

Intermittent but frequent - occurs every 1-2 minutes during normal operation.

Log Example

2026-04-06T15:06:15.817+08:00 [diagnostic] lane task error: lane=main durationMs=45187 error="TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))"
2026-04-06T15:06:15.821+08:00 [openclaw] Unhandled promise rejection: TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

Context

The error occurs during lane task execution, specifically when notifyActiveTaskWaiters is called. It appears to be a null/undefined pointer issue where the code attempts to iterate over a value that is unexpectedly undefined.

The crash causes the gateway to restart, interrupting ongoing conversations and tasks.

extent analysis

TL;DR

The most likely fix involves ensuring that the value passed to Array.from() in the notifyActiveTaskWaiters function is not undefined before attempting to iterate over it.

Guidance

  • Review the notifyActiveTaskWaiters function in command-queue-Cssp02gj.js to identify why the value is undefined when Array.from() is called.
  • Verify that all possible code paths leading to notifyActiveTaskWaiters ensure the iterated value is defined and iterable.
  • Consider adding a null check before calling Array.from() to prevent the error and potentially log or handle the undefined case gracefully.
  • Investigate the lane task execution context to understand why the value might be undefined, focusing on data flow and potential asynchronous operations that could lead to this state.

Example

// Example null check before calling Array.from()
function notifyActiveTaskWaiters(waiters) {
  if (waiters !== undefined && waiters !== null) {
    const waiterArray = Array.from(waiters);
    // Proceed with waiterArray
  } else {
    console.error('Waiters is undefined or null');
    // Handle or log the error appropriately
  }
}

Notes

This guidance assumes that the issue is indeed related to the undefined value being passed to Array.from(). Further debugging may be necessary to identify the root cause of why this value is undefined.

Recommendation

Apply a workaround by adding null checks and handling for undefined values before iterating, as this directly addresses the error message and prevents crashes, allowing for more stable operation while the root cause is further investigated.

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 TypeError: undefined is not iterable at notifyActiveTaskWaiters (command-queue) [1 pull requests, 1 comments, 2 participants]