ioBroker / ioBroker.zigbee

Zigbee communcation with Hue, Xiaomi, Lighttify... via TI CC2xxx USB stick
MIT License
317 stars 190 forks source link

DatabaseEntry with ID '21' already exists - Adapter restarts #2244

Open martinschm opened 1 month ago

martinschm commented 1 month ago

Hi,

I re-added a aqara sensor and got the following error which subsequently brought the whole zigbee adapter down and to re-start. I could not see the device in the device overview anymore, so I could not delete it. Upon starting the connection mode I was able to add the device again.

I would suggest to add at least a exception handler to avoid adapter crashes and display a error message on the interface.

Running Zigbee Adapter 1.10.3; js-controller 6.0.11, node.js 20


zigbee.0 | 2024-10-19 11:30:07.996 | error | DatabaseEntry with ID '21' already exists
-- | -- | -- | --
zigbee.0 | 2024-10-19 11:30:07.996 | error | Error: DatabaseEntry with ID '21' already exists at Database.insert (/opt/iobroker/node_modules/zigbee-herdsman/dist/controller/database.js:34:19) at Device.undelete (/opt/iobroker/node_modules/zigbee-herdsman/dist/controller/model/device.js:383:35) at Controller.onDeviceJoined (/opt/iobroker/node_modules/zigbee-herdsman/dist/controller/controller.js:485:20) at ZStackAdapter.emit (node:events:519:28) at ZStackAdapter.onZnpRecieved (/opt/iobroker/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:625:22) at Znp.emit (node:events:519:28) at Znp.onUnpiParsed (/opt/iobroker/node_modules/zigbee-herdsman/dist/adapter/z-stack/znp/znp.js:99:18) at Parser.emit (node:events:519:28) at Parser.parseNext (/opt/iobroker/node_modules/zigbee-herdsman/dist/adapter/z-stack/unpi/parser.js:64:26) at Parser._transform (/opt/iobroker/node_modules/zigbee-herdsman/dist/adapter/z-stack/unpi/parser.js:43:14)
zigbee.0 | 2024-10-19 11:30:07.991 | error | unhandled promise rejection: DatabaseEntry with ID '21' already exists
zigbee.0 | 2024-10-19 11:30:07.990 | error | Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
asgothian commented 1 month ago

If you read the stack trace you can see that the error is actually raised in a library in a situation we cannot control directly.

I do not see this being implemented anytime soon