Matter.js update to 0.16

Hi @pierre-gilles,

No worries I’m patient :slight_smile

1 Like

Thanks for the feedback, I actually heard back from the maintainer of matter-js and there is indeed a bug in the library’s autoConnect: true parameter.

He published a fix here :

And he gave me a workaround in the meantime to fix the issue!

I’ll keep you posted as soon as I have a new functional and tested build :slight_smile:

1 Like

Alright, I made a new PR this morning, and indeed with autoConnect working, it changes everything — I was able to remove 50% of the code I had written for this migration :smiley:

A new build is available under a new tag:

gladysassistant/gladys:upgrade-matter-latest

I took the opportunity to make a few practical improvements:

1/ In the logs, warning messages when a device has not yet been added to Gladys are now displayed on a single line, at the « info » log level, because it’s not an error per se but just a warning:

2/ Refreshing the Matter device list, being sometimes a long operation on large Matter networks containing unavailable devices, I made this operation non-blocking for Gladys startup to avoid lengthening Gladys’s startup time.

@prohand can you re-test?

The new PR:

Thanks :slight_smile:

I just tested and it still seems there’s a problem because everything is shown offline
After the migration I see 3 matter nodes:

I’ll send you the logs in a DM

There may be remnants due to my various tests.
Otherwise I would need to completely remove matter and start from scratch by integrating matterbridge as if I were starting from an installation with the latest stable version of Gladys and then use upgrade-matter-latest

Thanks for the test and the logs, that helps me a lot!

You have a device that is unreachable and, as a result, it breaks the rest of the integration. I’m adding code so that won’t be the case, and I’ll make a build for you :slight_smile:

Quick question: which architecture are you testing on: amd64 or arm64? ARM builds take longer, so if it’s amd64 I’ll do an amd64 Docker build only — it saves time :slight_smile:

It’s amd64 :slight_smile:
Thanks

1 Like

New build with fix available at:

gladysassistant/gladys:upgrade-matter-latest

I no longer see the Matter nodes when updating.
It seems the migration isn’t happening.
I’ll send you the logs in a DM :wink:

The error is quite clear, it’s a bug in the matter.js library!

2026-03-23 11:20:33.533 ERROR  ClientNode           [internal] Unsupported async initialization detected when loading known peer
  at ClientNode.initialize (/src/server/services/matter/node_modules/@matter/node/src/node/ClientNode.ts:101:19)
  at ClientNode.[construct] (/src/server/services/matter/node_modules/@matter/node/src/endpoint/Endpoint.ts:896:21)
  at initializer (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:289:80)
  at invokeInitializer (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:598:30)
  at Construction.start (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:290:17)
  at Factory.create (/src/server/services/matter/node_modules/@matter/node/src/node/client/Peers.ts:495:27)
  at Peers.initialize (/src/server/services/matter/node_modules/@matter/node/src/node/client/Peers.ts:108:25)
  at ServerNode.get peers [as peers] (/src/server/services/matter/node_modules/@matter/node/src/node/ServerNode.ts:168:29)
  at ChangeNotificationService.#beginPeerObservation (/src/server/services/matter/node_modules/@matter/node/src/node/integration/ChangeNotificationService.ts:112:27)
  at /src/server/services/matter/node_modules/@matter/node/src/node/integration/ChangeNotificationService.ts:35:50
  at BasicObservable.emit (/src/server/services/matter/node_modules/@matter/general/src/util/Observable.ts:377:26)
  at NodeLifecycle.change (/src/server/services/matter/node_modules/@matter/node/src/endpoint/properties/EndpointLifecycle.ts:226:32)
  at onReady (/src/server/services/matter/node_modules/@matter/node/src/endpoint/properties/Behaviors.ts:264:38)
  at ServerNode.initialize (/src/server/services/matter/node_modules/@matter/node/src/node/ServerNode.ts:188:9)
2026-03-23T11:20:33+0100 \u003cwarn\u003e service.start.js:44 (Service.start) Unable to start service matter [crashed-dependency] MatterController unavailable due to initialization error
      at crashedError (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:623:32)
      at handleRejection (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:325:69)
    Caused by: [crashed-dependency] matter-controller-data.peer2 initialization failed
      at Object.assertActive (/src/server/services/matter/node_modules/@matter/general/src/util/Lifecycle.ts:48:23)
      at Construction.assert (/src/server/services/matter/node_modules/@matter/general/src/util/Construction.ts:298:23)
      at Behaviors.#backingFor (/src/server/services/matter/node_modules/@matter/node/src/endpoint/properties/Behaviors.ts:736:41)
      at Object.get [as commissioning] (/src/server/services/matter/node_modules/@matter/node/src/endpoint/properties/Behaviors.ts:799:32)
      at ClientNode.maybeStateOf (/src/server/services/matter/node_modules/@matter/node/src/endpoint/Endpoint.ts:225:22)
      at Peers.get (/src/server/services/matter/node_modules/@matter/node/src/node/client/Peers.ts:184:46)
      at MatterController.#migrateNodeData (/src/server/services/matter/node_modules/@project-chip/matter.js/src/MatterController.ts:695:45)
      at /src/server/services/matter/node_modules/@project-chip/matter.js/src/MatterController.ts:399:17

I’ve sent the error to the maintainer, I’ll keep you posted

1 Like

I’m reposting my message here as a reminder, the maintainer of matter.js is asking me for an archive of your matter folder (/var/lib/gladysassistant/matter in Gladys), this will allow him to replay the migration and see what’s crashing in your case.

Thanks!

I’ll send you the folder in a PM :slight_smile:

1 Like