Crash on start when network connection can't be established
What happened?
Every once in a while my slab-06p7 stops responding for a few seconds. zigbee2mqtt stops, with a " Socket error Error: read ETIMEDOUT" ; which the Home Assistant watch dog does react to by restarting zigbee2mqtt, however after that you get a node.js crash due to unhandled error.
This prevents the HA watchdog to kick in again.
version 2.14.1-1 logs:
[2026-09-10 03:13:06] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/hallway_1_switch', payload '{"linkquality":150,"power_on_behavior":null,"state":"OFF"}'
[2026-09-10 03:13:32] error: zh:zstack:znp: Socket error Error: read ETIMEDOUT
[2026-09-10 03:13:32] info: zh:zstack:znp: Port closed
[2026-09-10 03:13:32] info: zh:zstack:znp: closing
[2026-09-10 03:13:32] error: z2m: Adapter disconnected, stopping
[2026-09-10 03:13:32] info: z2m: Stopping Zigbee2MQTT (restart=false, code=2, signal=undefined)
[2026-09-10 03:13:32] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"offline"}'
[2026-09-10 03:13:32] info: z2m: Disconnecting from MQTT server
[2026-09-10 03:13:32] info: z2m: Stopping zigbee-herdsman...
[2026-09-10 03:13:32] info: z2m: Stopped zigbee-herdsman
[2026-09-10 03:13:32] info: z2m: Stopped Zigbee2MQTT
WATCHDOG: Waiting 0.03333333333333333min before next start try.
Starting Zigbee2MQTT with watchdog (2000,60000,300000,900000,1800000,3600000).
[2026-09-10 03:13:34] info: z2m: Logging to console, file (filename: log.log)
[2026-09-10 03:13:34] info: z2m: Starting Zigbee2MQTT version 2.14.1 (commit #unknown)
[2026-09-10 03:13:34] info: z2m: Starting zigbee-herdsman (10.9.2)
[2026-09-10 03:13:34] info: zh:zstack:znp: Opening TCP socket with 192.168.10.7:6638
[2026-09-10 03:13:42] error: zh:zstack:znp: Socket error Error: connect EHOSTUNREACH 192.168.10.7:6638
[2026-09-10 03:13:42] error: z2m: Error while starting zigbee-herdsman
[2026-09-10 03:13:42] error: z2m: Failed to start zigbee-herdsman
[2026-09-10 03:13:42] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2026-09-10 03:13:42] error: z2m: Exiting...
[2026-09-10 03:13:42] error: z2m: Error: Error while opening socket
at Socket.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:160:24)
at Socket.emit (node:events:521:24)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
[2026-09-10 03:13:42] info: zh:zstack:znp: Port closed
node:events:487
throw er; // Unhandled 'error' event
^
NodeError: write after end
at writeAfterEnd (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:264:12)
at Writable.write (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:300:21)
at DerivedLogger.ondata (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:629:20)
at DerivedLogger.emit (node:events:521:24)
at addChunk (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:279:12)
at readableAddChunk (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:262:11)
at Readable.push (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:228:10)
at Transform.push (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_transform.js:132:32)
at DerivedLogger._transform (/app/node_modules/.pnpm/[email protected]/node_modules/winston/lib/winston/logger.js:337:12)
at Transform._read (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_transform.js:166:10)
Emitted 'error' event on DerivedLogger instance at:
at DerivedLogger.transportEvent (/app/node_modules/.pnpm/[email protected]/node_modules/winston/lib/winston/logger.js:663:12)
at File.emit (node:events:521:24)
at errorOrDestroy (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/internal/streams/destroy.js:90:101)
at writeAfterEnd (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:266:3)
at Writable.write (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:300:21)
at DerivedLogger.ondata (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:629:20)
at DerivedLogger.emit (node:events:521:24)
at addChunk (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:279:12)
at readableAddChunk (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:262:11)
at Readable.push (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_readable.js:228:10)
Node.js v24.18.1
What did you expect to happen?
No response
How to reproduce it (minimal and precise)
No response
Zigbee2MQTT version
2.14.1-1
Adapter firmware version
20260311
Adapter
SLZB-06p7U
Setup
Add-on on Home Assistant using Home Assistant OS (in a x86_64 VM)
Device database.db entry
No response
Debug log
No response
Notes
No response
This error indicates your adapter is not accessible via the ip address/port you specified in the configuration.
error: zh:zstack:znp: Socket error Error: connect EHOSTUNREACH 192.168.10.7:6638
Before starting you might want to check if you can connect/ping the adapter. Also check you've enabled TCP option in the SLZB web gui.
Did you read the bug description? That's what I described in the bug description to start. The adapter fails to respond from time to time.
Still, zigbee2mqtt shouldn't be crashing (which causes HA watchdog to crash as well)
I can reproduce a very similar failure with Zigbee2MQTT 2.14.1-1 on the Home Assistant add-on.
In my case the initial trigger was a temporary DNS resolution failure for a TCP-connected zstack coordinator:
[2026-09-12 06:33:27] info: zh:zstack:znp: Opening TCP socket with zigbee-coordinator.local:7638
[2026-09-12 06:33:27] error: zh:zstack:znp: Socket error Error: getaddrinfo ENOTFOUND zigbee-coordinator.local
[2026-09-12 06:33:27] error: z2m: Error while starting zigbee-herdsman
[2026-09-12 06:33:27] error: z2m: Failed to start zigbee-herdsman
[2026-09-12 06:33:27] error: z2m: Exiting...
[2026-09-12 06:33:27] error: z2m: Error: Error while opening socket
This is then followed by the same unhandled logger error:
NodeError: write after end
Versions:
Zigbee2MQTT: 2.14.1
zigbee-herdsman: 10.9.2
Node.js: 24.18.1
Setup: Home Assistant add-on, TCP zstack coordinator
After the incident, DNS resolution and TCP connectivity were both normal again.
Home Assistant's Supervisor watchdog was enabled at the time of the incident. The Zigbee2MQTT add-on's internal watchdog was not enabled yet.
I have since enabled the internal watchdog (watchdog: default) and rebooted
Home Assistant. Zigbee2MQTT currently starts and runs normally again.
So this seems not limited to EHOSTUNREACH; a transient ENOTFOUND while
opening a TCP adapter can also hit the same write after end crash path.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days