Homekit failed to initializing homekit bridge on boot

Tried searching the interwebs for this error and it seems I’m the first to hit it! Lucky me.

My OpenHab 3.4.0 instance is performing well with the homekit addon. I’d upgraded about a week ago. However, today I rebooted the raspberry-pi on which OpenHab is running and noticed that while OpenHab properly started and the sitemaps were accessible and responding as I’d expect, homekit integration was completely not working.

A scan of the logs showed this error:

2022-12-21 21:25:04.611 [INFO ] [mekit.internal.HomekitChangeListener] - Created 54 HomeKit items in instance 1.
2022-12-21 21:25:04.694 [WARN ] [nhab.io.homekit.internal.HomekitImpl] - could not initialize HomeKit bridge: No such device

First time I have seen this and neither google nor this forum has ever, apparently, seen the phrase “could not initialize homekit bridge”, so I assume I’m the first.

To work around, I was able to go in to the karaf console and restart the bundle, which resolved the problem:

bundle stop org.openhab.io.homekit
bundle start org.openhab.io.homekit

It’s probably a race condition during initialization that I was unlucky enough to hit.

Creating the thread so we have somewhere to track the problem, and for others to find and report if they run in to it.

Created an issue on GitHub: