Skip to content

[Bug]: Mac App overwrites openclaw.json and strips gateway.auth, causing bind=lan gateway crash loop #21009

@doomsday616

Description

@doomsday616

Summary

When gateway.bind is set to lan, the Mac App periodically overwrites openclaw.json and removes the gateway.auth section. This causes the gateway to enter a crash loop because newer versions refuse to bind to LAN without auth.

Steps to reproduce

  1. Set gateway.bind: "lan" and gateway.auth.token: "some-token" in ~/.openclaw/openclaw.json
  2. Start the gateway via LaunchAgent — it starts fine
  3. Open the Mac App (or wait for it to sync config)
  4. Mac App overwrites openclaw.json — the gateway.auth key is gone
  5. Gateway detects config change, restarts, and immediately fails with Refusing to bind gateway to lan without auth
  6. KeepAlive: true in the plist causes launchd to restart it endlessly — crash loop

Expected behavior

Mac App should preserve unknown/user-added keys in openclaw.json when it writes config back to disk — or at minimum preserve gateway.auth.

Actual behavior

Mac App drops gateway.auth entirely on every config write. The gateway then enters an infinite crash loop:

2026-02-19T22:20:06.944+08:00 Refusing to bind gateway to lan without auth.
Set gateway.auth.token/password (or OPENCLAW_GATEWAY_TOKEN/OPENCLAW_GATEWAY_PASSWORD) or pass --token/--password.

This repeats every ~10 seconds indefinitely. The feishu channel also goes down as a result.

Setting OPENCLAW_GATEWAY_TOKEN in the plist's EnvironmentVariables does work as a workaround for the initial startup, but the Mac App's config overwrite still triggers a gateway restart (it detects gateway.auth changed), causing brief outages each time.

Version

2026.2.17

Operating system

macOS 26.3 (Apple Silicon)

Install method

npm global + Mac App (both running simultaneously)

Logs, screenshots, and evidence

gateway.err.log after Mac App overwrites config — this pattern repeats hundreds of times:

2026-02-19T22:20:06.944+08:00 Refusing to bind gateway to lan without auth.
2026-02-19T22:20:17.822+08:00 Refusing to bind gateway to lan without auth.
2026-02-19T22:20:37.233+08:00 Refusing to bind gateway to lan without auth.
...

From /tmp/openclaw/openclaw-2026-02-19.log, the Mac App overwrite is visible:

Config overwrite: /Users/doomsday616/.openclaw/openclaw.json
config change detected; evaluating reload (gateway.auth)
config change requires gateway restart (gateway.auth)

Also: openclaw doctor reports feishu channel as failed (unknown) - Request failed with status code 400 after the crash loop.

Impact and severity

  • Affected: Anyone using bind=lan with both the Mac App and CLI gateway running
  • Severity: High — gateway is completely down until manually fixed
  • Frequency: 100% repro, happens every time Mac App writes config
  • Consequence: All channels (feishu, etc.) go offline. The crash loop also generates a 3GB+ gateway.log from repeated startup attempts.

Additional information

Workaround: switch gateway.bind to loopback so auth is not required. This avoids the crash but means LAN devices can't connect to the gateway.

openclaw doctor --fix partially helps — it regenerates a token — but the Mac App will overwrite it again on next config sync.

The root issue seems to be that the Mac App maintains its own in-memory copy of openclaw.json and does full overwrites without merging user-added keys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions