home-assistant-matter-hub: [Bug] 3.0.0-alpha.69 failed to start

Version

3.0.0-alpha.69

Matter Controller

Alexa

Steps to reproduce

I’ve update to .3.0.0-alpha.69 from 3.0.0-alpha.68. After a reboot the add-on could not start anymore. Here the log: `s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 2025-02-14 14:40:28.157 FATAL Logger Unhandled error detected: bridgeIds.map is not a function at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27) file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938 bridgeIds.map( ^

TypeError: bridgeIds.map is not a function at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27)

Node.js v18.20.4 s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service base-addon-log-level: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service base-addon-log-level successfully stopped s6-rc: info: service base-addon-banner: stopping s6-rc: info: service base-addon-banner successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting

-----------------------------------------------------------  Add-on: Home-Assistant-Matter-Hub  Publish your entities from Home Assistant to any Matter-compatible controller like Alexa, Apple Home or Google Home. -----------------------------------------------------------  Add-on version: 3.0.0-alpha.69  You are running the latest version of this add-on.  System: Home Assistant OS 14.2 (amd64 / qemux86-64)  Home Assistant Core: 2025.2.3  Home Assistant Supervisor: 2025.02.1 -----------------------------------------------------------  Please, share the above information when looking for help  or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service legacy-services: starting s6-rc: info: service legacy-services successfully started 2025-02-14 14:40:34.398 FATAL Logger Unhandled error detected: bridgeIds.map is not a function at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27) file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938 bridgeIds.map( ^

TypeError: bridgeIds.map is not a function at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26) at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5) at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27)

Node.js v18.20.4 s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service base-addon-log-level: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service base-addon-log-level successfully stopped s6-rc: info: service base-addon-banner: stopping s6-rc: info: service base-addon-banner successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped`

Now i’m back on the 68 Release and it works again.

Best regards Tobi

State and attributes

No response

Relevant log output


Documentation & Issues

  • I have reviewed the documentation and the linked troubleshooting guide.
  • I have searched the issues for a similar problem.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 19 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you all for the information. That was very helpful finding the race condition in the migration logic. A new release is on its way. (~5min)

It seems the migration has some issues with stringified json.

The main bridge config file under /data/app.json on alpha-68 looks like this: ( For HA OS it’s /root/addon_configs/491eb00d_hamh/data/; id properly varies)

{
 "bridges": {
  "ids": "[\"836d976441f3411d9ffff06adc033aba\"]",
  "836d976441f3411d9ffff06adc033aba": "{\"name\":\"Test\",\"port\":5541,\"filter\":{\"include\":[],\"exclude\":[]},\"featureFlags\":{\"matterSpeakers\":false,\"matterFans\":false,\"mimicHaCoverPercentage\":false},\"id\":\"836d976441f3411d9ffff06adc033aba\",\"basicInformation\":{\"vendorId\":65521,\"vendorName\":\"t0bst4r\",\"productId\":32768,\"productName\":\"MatterHub\",\"productLabel\":\"Home Assistant Matter Hub\",\"hardwareVersion\":2024,\"softwareVersion\":2024},\"status\":\"stopped\",\"statusReason\":\"Bridge is not yet started\",\"commissioning\":{\"isCommissioned\":false,\"passcode\":3179677,\"discriminator\":921,\"manualPairingCode\":\"05033301941\",\"qrPairingCode\":\"MT:Y.K90IRV01HV0B0L200\",\"fabrics\":[]},\"deviceCount\":0}"
 }

On the first start after updating the migration creates a new sub-directory app and splits it up into a bridges.ids file containing an array of all bridge ids and an additional file for each bridge e.g. bridges.836d976441f3411d9ffff06adc033aba:

/data/app/bridges.ids:

["836d976441f3411d9ffff06adc033aba"]

/data/app/bridges.836d976441f3411d9ffff06adc03:

{"name":"Test","port":5541,"filter":{"include":[],"exclude":[]},"featureFlags":{"matterSpeakers":false,"matterFans":false,"mimicHaCoverPercentage":false},"id":"836d976441f3411d9ffff06adc033aba","basicInformation":{"vendorId":65521,"vendorName":"t0bst4r","productId":32768,"productName":"MatterHub","productLabel":"Home Assistant Matter Hub","hardwareVersion":2024,"softwareVersion":2024},"status":"stopped","statusReason":"Bridge is not yet started","commissioning":{"isCommissioned":false,"passcode":3179677,"discriminator":921,"manualPairingCode":"05033301941","qrPairingCode":"MT:Y.K90IRV01HV0B0L200","fabrics":[]},"deviceCount":0}
Migration log alpha68 -> alpha69
matter-hub-1  | 2025-02-15 00:46:24.051 WARN   CustomStorage        Migrating legacy storage (JSON file) to new storage (directory): /data/app
matter-hub-1  | 2025-02-15 00:46:24.068 WARN   CustomStorage        Migrating legacy storage (JSON file) to new storage (directory): /data/836d976441f3411d9ffff06adc033aba

This all works fine. But after a restart it seems to run the migration again and stringifies the data:

/data/app/bridges.ids:

"[\"836d976441f3411d9ffff06adc033aba\"]"

/data/app/bridges.836d976441f3411d9ffff06adc03:

"{\"name\":\"Test\",\"port\":5541,\"filter\":{\"include\":[],\"exclude\":[]},\"featureFlags\":{\"matterSpeakers\":false,\"matterFans\":false,\"mimicHaCoverPercentage\":false},\"id\":\"836d976441f3411d9ffff06adc033aba\",\"basicInformation\":{\"vendorId\":65521,\"vendorName\":\"t0bst4r\",\"productId\":32768,\"productName\":\"MatterHub\",\"productLabel\":\"Home Assistant Matter Hub\",\"hardwareVersion\":2024,\"softwareVersion\":2024},\"status\":\"stopped\",\"statusReason\":\"Bridge is not yet started\",\"commissioning\":{\"isCommissioned\":false,\"passcode\":3179677,\"discriminator\":921,\"manualPairingCode\":\"05033301941\",\"qrPairingCode\":\"MT:Y.K90IRV01HV0B0L200\",\"fabrics\":[]},\"deviceCount\":0}"
Migration log after 1st restart on alpha69
matter-hub-1  | 2025-02-15 00:53:14.901 WARN   CustomStorage        Migrating legacy storage (JSON file) to new storage (directory): /data/app
matter-hub-1  | 2025-02-15 00:53:14.921 FATAL  Logger               Unhandled error detected: bridgeIds.map is not a function
matter-hub-1  |   at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17)
matter-hub-1  |   at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5)
matter-hub-1  |   at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26)
matter-hub-1  |   at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5)
matter-hub-1  |   at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27)
matter-hub-1  | file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938
matter-hub-1  |       bridgeIds.map(
matter-hub-1  |                 ^
matter-hub-1  |
matter-hub-1  | TypeError: bridgeIds.map is not a function
matter-hub-1  |     at _BridgeStorage.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:938:17)
matter-hub-1  |     at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5)
matter-hub-1  |     at async _BridgeService.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3570:26)
matter-hub-1  |     at async Environment.load (file:///usr/local/lib/node_modules/home-assistant-matter-hub/node_modules/@matter/general/dist/esm/environment/Environment.js:89:5)
matter-hub-1  |     at async _WebApi.initialize (file:///usr/local/lib/node_modules/home-assistant-matter-hub/dist/backend/cli.js:3850:27)
matter-hub-1  |
matter-hub-1  | Node.js v20.18.3
matter-hub-1 exited with code 1

After some quick testing I found out that at least on the docker image the migration seems to be very inconsistent and does not delete /data/app.json and /data/BRIDGEID.json everytime after migrating. This causes the migration to trigger again on restart but I haven’t had time to figure out why it saves the data as stringified json on the second migration.


How to fix:

a) Wait for a fix b) Downgrade to alpha68

c) If you are impatient you can manually fix it by deleting the old storage files and converting the new config files back to plain json. Do this at your own risk. To convert the stringified json back to plain json you can use any online tool (like https://onlinestringtools.com/json-parse-string) or just use the command line. Here is how I did it on HomeAssistant os:

  1. Stop the Addon
  2. Open the Terminal; change directory to /root/addon_configs/491eb00d_hamh/data/ (the addon id may vary?):
  3. Confirm that the migration took place by checking if the directory app exists and that it contains the two mentioned files.
  4. In /root/addon_configs/491eb00d_hamh/data/ delete the old file app.json and the bridge config BRIDGEID.json (or move them somewhere else).
  5. In the /root/addon_configs/491eb00d_hamh/data/app directory run the following two commands (replace with your id):
jq fromjson bridges.ids > bridges.ids.tmp && mv bridges.ids.tmp bridges.ids
jq fromjson bridges.836d976441f3411d9ffff06adc033aba > bridges.836d976441f3411d9ffff06adc033aba.tmp && mv bridges.836d976441f3411d9ffff06adc033aba.tmp bridges.836d976441f3411d9ffff06adc033aba

If anyone is having this issue, you can load up a recent backup and restore ONLY the home assistant matter hub Add-on. It’s very fast and works great, I had no issue restoring to alpha 68