openclaw - ✅(Solved) Fix [Bug]: openclaw doctor crashes in 2026.4.14: clearPluginInteractiveHandlersState calls .clear() on callback dedupe state [5 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#67525Fetched 2026-04-17 08:30:14
View on GitHub
Comments
0
Participants
1
Timeline
14
Reactions
0
Timeline (top)
cross-referenced ×6referenced ×6labeled ×2

openclaw doctor crashes on OpenClaw 2026.4.14 with:

TypeError: Cannot read properties of undefined (reading 'clear')

This happens during the "Memory search" section, but the actual root cause appears to be in plugin interactive handler state cleanup, not memory artifacts.

Error Message

openclaw doctor

Observed output

Memory artifact repair could not be completed: Cannot read properties of undefined (reading 'clear') TypeError: Cannot read properties of undefined (reading 'clear') at clearPluginInteractiveHandlersState (file:///.../dist/types-BfKfz-lz.js:68:35) at clearPluginInteractiveHandlers (file:///.../dist/types-BfKfz-lz.js:104:2) at loadOpenClawPlugins (file:///.../dist/loader-DYJR63Q1.js:2236:4) at resolveRuntimePluginRegistry (file:///.../dist/loader-DYJR63Q1.js:1929:9) at ensureMemoryRuntime (file:///.../dist/memory-runtime-ChTyWPZf.js:8:2) at getActiveMemorySearchManager (file:///.../dist/memory-runtime-ChTyWPZf.js:12:18) at resolveRuntimeMemoryAuditContext (file:///.../dist/prompt-select-styled-DAn24U1O.js:3399:25) at maybeRepairMemoryRecallHealth (file:///.../dist/prompt-select-styled-DAn24U1O.js:3461:25)

Steps to reproduce

Run:

Root Cause

This happens during the "Memory search" section, but the actual root cause appears to be in plugin interactive handler state cleanup, not memory artifacts.

Fix Action

Fixed

PR fix notes

PR #67526: fix: prevent crash in clearPluginInteractiveHandlersState when callbackDedupe is undefined

Description (problem / solution / changelog)

Summary

Fixes a crash in openclaw doctor where clearPluginInteractiveHandlersState() calls .clear() on an undefined callbackDedupe object.

Root Cause

The getPluginInteractiveCallbackDedupeState() function may return undefined in certain initialization scenarios (particularly during doctor memory search). When clearPluginInteractiveHandlersState() unconditionally calls .clear() on this potentially undefined value, it throws:

TypeError: Cannot read properties of undefined (reading 'clear')

Fix

Add a null/undefined check before calling dedupe.clear():

const dedupe = getPluginInteractiveCallbackDedupeState();
if (dedupe) {
  dedupe.clear();
}

Test Plan

  • Existing unit tests pass (src/plugins/interactive.test.ts)
  • Fix is minimal and defensive

Closes openclaw#67525

Changed files

  • src/plugins/interactive-state.ts (modified, +4/-1)

PR #67528: fix: add null guards in clearPluginInteractiveHandlersState to prevent doctor crash

Description (problem / solution / changelog)

Summary

Fixes #67525

openclaw doctor crashes with TypeError: Cannot read properties of undefined (reading 'clear') when clearPluginInteractiveHandlersState() is called and the global singleton has partial/corrupted state (e.g., callbackDedupe is undefined).

Changes

  • src/plugins/interactive-state.ts: Refactored clearPluginInteractiveHandlersState() to call getState() once and use optional chaining (?.) on all .clear() calls, preventing crashes when any state field is undefined.
  • src/plugins/interactive-state.test.ts: Added tests covering normal clear, undefined callbackDedupe, and undefined inflightCallbackDedupe scenarios.

Root Cause

The function called individual getters (getPluginInteractiveHandlersState(), getPluginInteractiveCallbackDedupeState()) which always return valid objects when initialized normally. However, if the global singleton was set by an older version or corrupted, these fields could be undefined, causing the crash during openclaw doctor's memory audit phase.

Changed files

  • src/plugins/interactive-state.test.ts (added, +42/-0)
  • src/plugins/interactive-state.ts (modified, +4/-3)

PR #67581: fix: prevent crash in clearPluginInteractiveHandlersState when callbackDedupe is undefined

Description (problem / solution / changelog)

Summary

Fixes a crash in openclaw doctor where clearPluginInteractiveHandlersState throws "Cannot read properties of undefined (reading 'clear')".

Root Cause

In src/plugins/interactive-state.ts, the clearPluginInteractiveHandlersState() function calls getPluginInteractiveCallbackDedupeState().clear() without checking if the return value is undefined. When the plugin interactive state hasn't been fully initialized (e.g., during the doctor flow), this causes a TypeError.

Fix

Added optional chaining (?.) when calling .clear() on the callback dedupe state, matching the pattern already used elsewhere in the codebase for defensive null checks.

Test Plan

  • Build passes
  • Code follows existing patterns in the file

Closes openclaw#67525

Changed files

  • src/plugins/interactive-state.ts (modified, +1/-1)

PR #67608: Plugins: repair legacy interactive singleton for doctor clear (#67525)

Description (problem / solution / changelog)

Summary

  • Problem: \clearPluginInteractiveHandlersState\ called .clear()\ on \callbackDedupe\ when older/partial global singleton state omitted that field, crashing \openclaw doctor\ during plugin load/memory paths (#67525).
  • Fix: After resolving the plugin interactive singleton, repair missing \callbackDedupe\ / \inflightCallbackDedupe\ before any consumer runs clear.
  • Test: \src/plugins/interactive-state.test.ts\ simulates legacy shape.

Linked Issue

  • Closes #67525

Change Type

  • Bug fix

Scope

  • Gateway / orchestration (plugin load path used by doctor)

Security Impact

No behavior change for valid state; defensive repair only.

Made with Cursor

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/plugins/interactive-state.test.ts (added, +19/-0)
  • src/plugins/interactive-state.ts (modified, +25/-3)

PR #67630: fix(memory): guard against stale qmdManagerCache singleton causing memory_search TypeError

Description (problem / solution / changelog)

Summary

Fixes #67549

memory_search agent tool throws TypeError: Cannot read properties of undefined (reading 'get') while openclaw memory search CLI works fine.

Root Cause

Same class of defect as #67525 (fixed in #67528).

In extensions/memory-core/src/memory/search-manager.ts, the module-level constant QMD_MANAGER_CACHE was destructured from getMemorySearchManagerCacheStore() at module initialization time:

const { qmdManagerCache: QMD_MANAGER_CACHE } = getMemorySearchManagerCacheStore();

getMemorySearchManagerCacheStore() uses resolveGlobalSingleton, which returns the existing globalThis value if the key exists — without validating the shape. If an older runtime version stored a different object shape at Symbol.for('openclaw.memorySearchManagerCache') (e.g. missing or renamed qmdManagerCache field), the destructuring yields undefined. Any subsequent QMD_MANAGER_CACHE.get(cacheKey) then throws:

TypeError: Cannot read properties of undefined (reading 'get')

The CLI path is unaffected because it uses a fresh process (no stale globalThis) and accesses the memory search manager through a separate import chain that doesn't go through the module-level constant.

Changes

extensions/memory-core/src/memory/search-manager.ts

  1. Shape validation in getMemorySearchManagerCacheStore: After resolveGlobalSingleton returns the store, validates that qmdManagerCache is a Map instance. If not, repairs it in-place, healing the singleton for all callers sharing the same globalThis slot.

  2. Lazy accessor replaces module-level constant: QMD_MANAGER_CACHE (bound at module init) replaced by getQmdManagerCache() function. Every call site now goes through the validated store path instead of capturing a potentially undefined reference at startup.

extensions/memory-core/src/memory/search-manager.test.ts

New describe('stale singleton cache guard') block with 3 tests:

  • getMemorySearchManager does not crash when qmdManagerCache is undefined
  • getMemorySearchManagerCacheStore repairs a stale singleton missing qmdManagerCache to an empty Map
  • closeAllMemorySearchManagers does not throw with stale qmdManagerCache

Relationship to #67525 / #67528

#67525#67549
Filesrc/plugins/interactive-state.tsextensions/memory-core/src/memory/search-manager.ts
Stale fieldcallbackDedupeqmdManagerCache
Crash method.clear().get()
Fix patternOptional chaininginstanceof guard + lazy accessor

Changed files

  • extensions/memory-core/src/memory/search-manager.test.ts (modified, +80/-1)
  • extensions/memory-core/src/memory/search-manager.ts (modified, +55/-13)

Code Example

openclaw doctor

## Observed output

Memory artifact repair could not be completed: Cannot read properties of undefined (reading 'clear')
TypeError: Cannot read properties of undefined (reading 'clear')
    at clearPluginInteractiveHandlersState (file:///.../dist/types-BfKfz-lz.js:68:35)
    at clearPluginInteractiveHandlers (file:///.../dist/types-BfKfz-lz.js:104:2)
    at loadOpenClawPlugins (file:///.../dist/loader-DYJR63Q1.js:2236:4)
    at resolveRuntimePluginRegistry (file:///.../dist/loader-DYJR63Q1.js:1929:9)
    at ensureMemoryRuntime (file:///.../dist/memory-runtime-ChTyWPZf.js:8:2)
    at getActiveMemorySearchManager (file:///.../dist/memory-runtime-ChTyWPZf.js:12:18)
    at resolveRuntimeMemoryAuditContext (file:///.../dist/prompt-select-styled-DAn24U1O.js:3399:25)
    at maybeRepairMemoryRecallHealth (file:///.../dist/prompt-select-styled-DAn24U1O.js:3461:25)

### Steps to reproduce

Run:

---
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Summary

openclaw doctor crashes on OpenClaw 2026.4.14 with:

TypeError: Cannot read properties of undefined (reading 'clear')

This happens during the "Memory search" section, but the actual root cause appears to be in plugin interactive handler state cleanup, not memory artifacts.

Version

  • OpenClaw: 2026.4.14
  • Platform: macOS
  • Install method: npm global install

Reproduction

Run:

openclaw doctor

## Observed output

Memory artifact repair could not be completed: Cannot read properties of undefined (reading 'clear')
TypeError: Cannot read properties of undefined (reading 'clear')
    at clearPluginInteractiveHandlersState (file:///.../dist/types-BfKfz-lz.js:68:35)
    at clearPluginInteractiveHandlers (file:///.../dist/types-BfKfz-lz.js:104:2)
    at loadOpenClawPlugins (file:///.../dist/loader-DYJR63Q1.js:2236:4)
    at resolveRuntimePluginRegistry (file:///.../dist/loader-DYJR63Q1.js:1929:9)
    at ensureMemoryRuntime (file:///.../dist/memory-runtime-ChTyWPZf.js:8:2)
    at getActiveMemorySearchManager (file:///.../dist/memory-runtime-ChTyWPZf.js:12:18)
    at resolveRuntimeMemoryAuditContext (file:///.../dist/prompt-select-styled-DAn24U1O.js:3399:25)
    at maybeRepairMemoryRecallHealth (file:///.../dist/prompt-select-styled-DAn24U1O.js:3461:25)

### Steps to reproduce

Run:

```bash
openclaw doctor

### Expected behavior

run openclaw doctor do not crash

### Actual behavior

Run openclaw doctor without crashing

### OpenClaw version

2026.4.14

### Operating system

macOS 14.7.8 (23H730)

### Install method

npm global

### Model

openai-codex gpt-5.4

### Provider / routing chain

openai-codex

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence

```shell

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The most likely fix is to update the clearPluginInteractiveHandlersState function to handle cases where the object being accessed is undefined.

Guidance

  • Review the clearPluginInteractiveHandlersState function in types-BfKfz-lz.js to ensure it properly checks for undefined objects before attempting to access properties.
  • Verify that the clearPluginInteractiveHandlers function is correctly calling clearPluginInteractiveHandlersState and handling any potential errors.
  • Check the loadOpenClawPlugins function in loader-DYJR63Q1.js to ensure it is properly initializing the plugin interactive handlers state.
  • Consider adding error handling to the openclaw doctor command to catch and log any errors that occur during execution, rather than crashing.

Example

// Example of how to check for undefined objects in clearPluginInteractiveHandlersState
function clearPluginInteractiveHandlersState(state) {
  if (state && state.clear) {
    state.clear();
  }
}

Notes

The exact fix will depend on the specific implementation of the clearPluginInteractiveHandlersState function and the surrounding code. Additional logging or debugging may be necessary to determine the root cause of the issue.

Recommendation

Apply a workaround by modifying the clearPluginInteractiveHandlersState function to handle undefined objects, as shown in the example above. This will prevent the crash and allow the openclaw doctor command to complete, but may not fully address the underlying issue.

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

run openclaw doctor do not crash

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING