openclaw - ✅(Solved) Fix [Bug] openclaw doctor crashes with TypeError "Cannot read properties of undefined (reading 'clear')" after update on v2026.4.21 [2 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#70006Fetched 2026-04-23 07:30:29
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
referenced ×3cross-referenced ×2closed ×1commented ×1

After running openclaw update on version 2026.4.21, the post-install doctor step fails with an unhandled TypeError: Cannot read properties of undefined (reading 'clear'). The package-manager install step completes successfully, but the update is reported as ERROR because openclaw doctor crashes.

Error Message

Updating OpenClaw...

│ ◇ ✓ Updating via package manager (24.64s) │ ◇ ✗ Running doctor checks (17.49s) [channels] bundled channel setup entry nextcloud-talk missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry nostr missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry signal missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry slack missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry synology-chat missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry tlon missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry whatsapp missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry zalo missing bundled-channel-setup-entry contract; skipping [channels] bundled channel setup entry zalouser missing bundled-channel-setup-entry contract; skipping TypeError: Cannot read properties of undefined (reading 'clear')

Update Result: ERROR Root: /home/node/.local/lib/node_modules/openclaw Reason: openclaw doctor Before: 2026.4.21 After: 2026.4.21

Total time: 42.69s

Root Cause

After running openclaw update on version 2026.4.21, the post-install doctor step fails with an unhandled TypeError: Cannot read properties of undefined (reading 'clear'). The package-manager install step completes successfully, but the update is reported as ERROR because openclaw doctor crashes.

Fix Action

Fixed

PR fix notes

PR #70111: fix(wizard): add null guard to spinner stop methods

Description (problem / solution / changelog)

Summary

  • Problem: openclaw doctor crashes with TypeError: Cannot read properties of undefined (reading 'clear') after openclaw update on v2026.4.21
  • Why it matters: Post-update doctor check fails, making openclaw update exit non-zero even when package manager step succeeds
  • What changed: Added optional chaining (?.) to spin?.clear() and spin?.stop() calls in the progress spinner teardown path
  • What did NOT change: No functional change to spinner behavior

Change Type

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #70006

Root Cause

  • Root cause: The progress spinner may be undefined when stop() is called during teardown, causing .clear() to throw TypeError
  • Same family as: #66641, #66718, #67100, #67411 (all "Cannot read properties of undefined" TypeErrors in onboard/configure paths)

User-visible / Behavior Changes

  • openclaw doctor no longer crashes after openclaw update
  • No change to normal operation

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Steps

  1. Run openclaw update
  2. Observe doctor checks run without crash

Expected

  • Doctor completes without TypeError
  • Update exits with success code

Actual (before fix)

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

Human Verification

  • Verified scenarios: Code change reviewed - optional chaining prevents crash
  • Edge cases checked: Normal operation unaffected (spinner works when defined)
  • What you did not verify: Runtime test on affected version

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Changed files

  • src/wizard/clack-prompter.test.ts (modified, +58/-25)
  • src/wizard/clack-prompter.ts (modified, +4/-4)

PR #70135: fix(plugins): avoid doctor crash on legacy interactive state

Description (problem / solution / changelog)

Summary

  • Problem: openclaw doctor could crash with Cannot read properties of undefined (reading 'clear') while clearing plugin interactive handler state.
  • Why it matters: openclaw update runs doctor post-install, so this turned a successful package update into an error path for affected installs.
  • What changed: hydrate legacy/partial openclaw.pluginInteractiveState shapes before clearing state, and always rebind callback dedupe from the dedicated global dedupe cache symbol.
  • What did NOT change (scope boundary): no changes to doctor UX, bundled channel warning behavior, or update flow policy.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #70006
  • Related #67525
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: plugin interactive state was treated as a live split-chunk global, but the state loader trusted any existing globalThis[Symbol.for("openclaw.pluginInteractiveState")] object shape. Legacy/partial state objects could therefore be missing callbackDedupe or inflightCallbackDedupe, and clearPluginInteractiveHandlersState() then called .clear() on undefined.
  • Missing detection / guardrail: no regression test covered clearing a legacy partial interactive state shape.
  • Contributing context (if known): doctor/plugin reload paths clear interactive handlers during plugin registry reload, which surfaced the stale global state shape.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/plugins/interactive.test.ts
  • Scenario the test should lock in: a legacy openclaw.pluginInteractiveState object that only has interactiveHandlers should be hydrated before clear, and interactive callback dedupe should still work afterward.
  • Why this is the smallest reliable guardrail: the crash is in the shared interactive state helper, so a focused state hydration test catches the exact failure mode without needing full doctor/update orchestration.
  • Existing test that already covers this (if any): none.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • openclaw doctor and openclaw update no longer crash on this legacy partial interactive-state shape.

Diagram (if applicable)

N/A

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: local Node 24 repo checkout
  • Model/provider: N/A
  • Integration/channel (if any): plugin interactive state helper
  • Relevant config (redacted): N/A

Steps

  1. Seed globalThis[Symbol.for("openclaw.pluginInteractiveState")] with a legacy partial object that only contains interactiveHandlers.
  2. Clear plugin interactive handlers via clearPluginInteractiveHandlers().
  3. Re-register a handler and dispatch the same callback twice.

Expected

  • Clear should not throw.
  • Missing dedupe state should be recreated.
  • Duplicate callback dispatch should still dedupe correctly.

Actual

  • Before the fix, clear could throw Cannot read properties of undefined (reading 'clear').

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • Reproduced the exact .clear() crash locally by seeding a legacy partial interactive state object before the fix.
    • Ran pnpm test src/plugins/interactive.test.ts after the fix.
  • Edge cases checked:
    • clearing a partial legacy state
    • interactive handler registration after hydration
    • duplicate callback dedupe still works after hydration
  • What you did not verify:
    • full openclaw update / openclaw doctor end-to-end in a Debian container
    • unrelated repo-wide typecheck failures outside this change

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: rebinding callbackDedupe during hydration could discard an unexpected nonstandard object stored under the legacy state key.
    • Mitigation: the real dedupe cache already has its own dedicated global symbol, and this change deliberately reuses that canonical cache instead of trusting ad hoc embedded state.
  • Risk: repo smart gate is currently red for unrelated files.
    • Mitigation: scoped verification passed with pnpm test src/plugins/interactive.test.ts; attempted pnpm check:changed failed only in untouched files src/agents/pi-embedded-runner/compact.ts and src/agents/pi-embedded-runner/run/attempt.ts.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/plugins/interactive-state.ts (modified, +48/-11)
  • src/plugins/interactive.test.ts (modified, +55/-0)

Code Example

openclaw update

---

Updating OpenClaw...

◇  ✓ Updating via package manager (24.64s)
◇  ✗ Running doctor checks (17.49s)
    [channels] bundled channel setup entry nextcloud-talk missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry nostr missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry signal missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry slack missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry synology-chat missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry tlon missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry whatsapp missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry zalo missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry zalouser missing bundled-channel-setup-entry contract; skipping
    TypeError: Cannot read properties of undefined (reading 'clear')

Update Result: ERROR
  Root: /home/node/.local/lib/node_modules/openclaw
  Reason: openclaw doctor
  Before: 2026.4.21
  After: 2026.4.21

Total time: 42.69s
RAW_BUFFERClick to expand / collapse

Summary

After running openclaw update on version 2026.4.21, the post-install doctor step fails with an unhandled TypeError: Cannot read properties of undefined (reading 'clear'). The package-manager install step completes successfully, but the update is reported as ERROR because openclaw doctor crashes.

Environment

  • OpenClaw version: 2026.4.21 (before = after, since no version bump was available in this run)
  • Node.js: v22.x (container runtime)
  • OS: Debian (inside a Docker container)
  • npm global prefix: /home/node/.local/lib/node_modules
  • Installed via: openclaw update (wrapper) and npm install -g openclaw@latest

Reproduction

openclaw update

Actual output

Updating OpenClaw...

◇  ✓ Updating via package manager (24.64s)
◇  ✗ Running doctor checks (17.49s)
    [channels] bundled channel setup entry nextcloud-talk missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry nostr missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry signal missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry slack missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry synology-chat missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry tlon missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry whatsapp missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry zalo missing bundled-channel-setup-entry contract; skipping
    [channels] bundled channel setup entry zalouser missing bundled-channel-setup-entry contract; skipping
    TypeError: Cannot read properties of undefined (reading 'clear')

Update Result: ERROR
  Root: /home/node/.local/lib/node_modules/openclaw
  Reason: openclaw doctor
  Before: 2026.4.21
  After: 2026.4.21

Total time: 42.69s

Expected behavior

openclaw doctor should either:

  1. Complete successfully with informative warnings about missing bundled-channel-setup-entry contracts, without throwing an unhandled TypeError, or
  2. Surface the actual error with a proper stack trace and context, so users can understand which subsystem failed.

Observations

  • The crash happens after the channel-contract warnings are logged, suggesting the error is raised in a UI/spinner tear-down path (the .clear() call on an undefined handle strongly points to a spinner or progress-indicator lifecycle bug).
  • No stack trace is printed — only the TypeError message — which makes root-cause analysis from the end-user side impossible.
  • The bundled-channel-setup-entry contract warnings are already tracked (see Related Issues). They are expected and non-fatal, but their accumulation appears to coincide with the crash here.

Impact

  • openclaw update exits non-zero on every run, even when the package manager step succeeds.
  • CI/CD pipelines, deployment scripts, and post-install health-check tooling that rely on openclaw update succeeding are now broken.
  • End users cannot distinguish "update actually failed" from "doctor check crashed after a successful update".

Suggested next steps

  • Add a stack trace to the doctor-crash path so the failing module is identifiable.
  • Add null-guards around spinner/progress handles in the doctor UI teardown.
  • Consider decoupling the doctor post-check from the update exit code, or exposing an openclaw update --skip-doctor flag.

Related issues

  • #69837 — openclaw update fails on 2026.4.20 with missing grammy in Telegram bundled runtimesame failure pattern (update step succeeds, post-update doctor fails), different root cause (module resolution vs UI handle).
  • #64433, #62921, #62923, #65851 — existing tracking for the bundled-channel-setup-entry contract warnings visible in the output above.
  • #66641, #66718, #67100, #67411 — same family of TypeError: Cannot read properties of undefined (reading 'X') null-guard gaps on other command paths (onboard, configure), for reference.

extent analysis

TL;DR

The most likely fix for the TypeError: Cannot read properties of undefined (reading 'clear') error in openclaw doctor is to add null-guards around spinner/progress handles in the doctor UI teardown.

Guidance

  • Review the openclaw doctor code to identify where the .clear() method is being called on an undefined handle, likely in a UI or spinner teardown path.
  • Add null-guards around the spinner/progress handles to prevent the TypeError from occurring.
  • Consider adding a stack trace to the doctor-crash path to improve root-cause analysis.
  • Evaluate decoupling the doctor post-check from the update exit code or exposing an openclaw update --skip-doctor flag to mitigate the impact of the crash.

Example

No code snippet is provided as the issue does not contain sufficient information about the openclaw doctor implementation.

Notes

The provided information suggests that the error is related to a UI or spinner teardown issue, but without access to the openclaw doctor code, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by adding null-guards around spinner/progress handles in the doctor UI teardown, as this is the most likely cause of the error and can be addressed without requiring a full code review.

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

openclaw doctor should either:

  1. Complete successfully with informative warnings about missing bundled-channel-setup-entry contracts, without throwing an unhandled TypeError, or
  2. Surface the actual error with a proper stack trace and context, so users can understand which subsystem failed.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING