Skip to content

Matrix plugin: ECONNRESET crash-loop on local Synapse homeserver (v2026.4.1-beta.1) #60783

@pagem7632-hcm

Description

@pagem7632-hcm

Bug Report

OpenClaw version: 2026.4.2
Matrix plugin version: @openclaw/matrix v2026.4.1-beta.1
Synapse version: v1.123.0 (local Docker, OrbStack)
Platform: macOS 26.3.1 (arm64), Mac Mini M-series

Summary

The Matrix plugin enters an infinite crash-restart loop when connecting to a local Synapse homeserver. All three agent accounts crash with:

fetch failed | read ECONNRESET

The plugin hard-exits on ECONNRESET instead of treating it as a transient network error and reconnecting gracefully.

Configuration

{
  "channels": {
    "matrix": {
      "homeserver": "http://localhost:8008",
      "allowPrivateNetwork": true,
      "accounts": {
        "nova": { "userId": "@nova:localhost", ... },
        "page": { "userId": "@page:localhost", ... },
        "junior": { "userId": "@junior:localhost", ... }
      }
    }
  }
}

What works

  • Direct curl sync requests to Synapse succeed perfectly (both IPv4 and IPv6)
  • allowPrivateNetwork: true is set
  • Tokens and deviceIds are valid (verified via curl)
  • Login via Element Web works fine manually
  • Synapse health check passes

What fails

Gateway logs show all three accounts in constant restart loop:

[matrix] [nova] channel exited: fetch failed | read ECONNRESET
[matrix] [nova] auto-restart attempt 4/10 in 44s
[matrix] [page] channel exited: fetch failed | read ECONNRESET
[matrix] [page] auto-restart attempt 4/10 in 43s
[matrix] [junior] channel exited: fetch failed | read ECONNRESET
[matrix] [junior] auto-restart attempt 4/10 in 42s

Root cause analysis

This appears to be a 30s keep-alive race condition: Synapse closes idle long-poll sync connections (timeout=30000ms) and Node.js/undici treats the TCP close as ECONNRESET. The plugin then hard-exits rather than reconnecting.

From the plugin source (matrix-runtime-surface-BQb_BOSl.js):

  • Line ~3421: throw err — the plugin exits on transient network errors rather than catching and reconnecting
  • Line ~3148: throw new Error(exit ${code}) — hard exit path triggered by ECONNRESET

Things tried

  • Updated tokens (fresh login tokens confirmed valid via curl)
  • Cleared credentials and matrix account storage
  • Pointed homeserver at nginx proxy (port 8009) to handle keep-alive
  • Added rc_login rate limit config to Synapse
  • Restarted gateway multiple times

Expected behaviour

The plugin should catch ECONNRESET as a transient network error and reconnect, not crash-exit.

Question

Is there a workaround available? Related issues #42234 and #7474 suggest this was known. Happy to test a fix or beta build.

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