Skip to content

Gateway crashes with AssertionError when IPv4 address transitions from defined to undefined #38628

@thomasquinlan

Description

@thomasquinlan

Description

The OpenClaw gateway crashes with an unhandled AssertionError when a network interface loses its IPv4 address (e.g., DHCP lease expiry, sleep/wake cycle, or transient network drop):

AssertionError: Reached illegal state! IPv4 address change from defined to undefined!
    at MDNSServer.handleUpdatedNetworkInterfaces (...)

This causes the entire gateway process to exit via an unhandled promise rejection.

Steps to Reproduce

  1. Run OpenClaw gateway on a machine with a network interface that may intermittently lose its IPv4 address
  2. Wait for the interface to drop (e.g., Mac Mini going to sleep, DHCP lease not renewing)
  3. Gateway crashes

Expected Behavior

The mDNS server should gracefully handle a network interface losing its IPv4 address — log a warning, stop advertising on that interface, and resume when the address returns. The gateway should not crash.

Actual Behavior

The gateway throws an AssertionError in MDNSServer.handleUpdatedNetworkInterfaces and the process exits with an unhandled promise rejection.

Environment

  • OS: macOS (Mac Mini, Ethernet, static IP configured)
  • OpenClaw version: 2026.3.x (latest)
  • Network: Ethernet with static IP; crash occurs when macOS briefly drops the interface (energy settings / Power Nap related)

Workaround

Disable Power Nap and enable "Prevent automatic sleeping when display is off" in macOS Energy settings. This reduces the frequency but does not eliminate the possibility of transient network drops.

Suggested Fix

In MDNSServer.handleUpdatedNetworkInterfaces, handle the case where an IPv4 address transitions to undefined gracefully instead of asserting. For example:

  • Remove the interface from the active mDNS responder set
  • Log a warning
  • Re-add when the address returns

This would make the gateway resilient to transient network changes, which are common on laptops, Mac Minis with sleep enabled, and machines with DHCP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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