openclaw - 💡(How to fix) Fix Bug: macOS zsh update handoff script crashes on `status=$?` — gateway never restarts after web UI Update Now

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…

When clicking Update Now in the web Control UI on macOS, the generated handoff wrapper script (openclaw-beta-update-handoff.sh) has #!/bin/zsh set -u and contains status=$? to capture the openclaw update exit code. In zsh, status is a readonly builtin variable, so the assignment crashes with read-only variable: status. The script terminates before completing the post-update gateway health check and clean exit.

The npm package update itself succeeds — the crash only prevents the restart and post-update diagnostics.

Root Cause

The handoff script template uses status as a local variable name. Zsh reserves status as readonly (equivalent to $?). With set -u, the assignment fails.

Fix Action

Fix

Rename statusret (or any non-reserved name):

ret=$?
echo "[$(date)] update exited status=$ret"
exit "$ret"

Code Example

#!/bin/zsh
set -u
echo "before"
status=$?
echo "after (never reached)"
# Output: read-only variable: status

---

#!/bin/zsh
set -u
# ...
openclaw update --channel beta --yes --json --timeout 1800
status=$?          # ← zsh: read-only variable: status
echo "[$(date)] update exited status=$status"
# ... never reached
exit "$status"

---

ret=$?
echo "[$(date)] update exited status=$ret"
exit "$ret"
RAW_BUFFERClick to expand / collapse

Summary

When clicking Update Now in the web Control UI on macOS, the generated handoff wrapper script (openclaw-beta-update-handoff.sh) has #!/bin/zsh set -u and contains status=$? to capture the openclaw update exit code. In zsh, status is a readonly builtin variable, so the assignment crashes with read-only variable: status. The script terminates before completing the post-update gateway health check and clean exit.

The npm package update itself succeeds — the crash only prevents the restart and post-update diagnostics.

Version

2026.5.31-beta.1 (ebba638), macOS (Homebrew global install, launchd-managed)

Root Cause

The handoff script template uses status as a local variable name. Zsh reserves status as readonly (equivalent to $?). With set -u, the assignment fails.

Minimal Reproduction

#!/bin/zsh
set -u
echo "before"
status=$?
echo "after (never reached)"
# Output: read-only variable: status

The Failing Script (condensed)

#!/bin/zsh
set -u
# ...
openclaw update --channel beta --yes --json --timeout 1800
status=$?          # ← zsh: read-only variable: status
echo "[$(date)] update exited status=$status"
# ... never reached
exit "$status"

Fix

Rename statusret (or any non-reserved name):

ret=$?
echo "[$(date)] update exited status=$ret"
exit "$ret"

Impact

Gateway stays dead after web UI updates on macOS until the launchd KeepAlive eventually fires (with backoff). Users must manually launchctl kickstart or run openclaw gateway start after every "Update Now" action.

Where to Look

The zsh wrapper does not appear to be in the bundled dist (the dist's macOS restart template correctly uses #!/bin/sh). It appears to be generated separately — likely by the update.run gateway RPC method or the managed service handoff path.

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: macOS zsh update handoff script crashes on `status=$?` — gateway never restarts after web UI Update Now