This error can be observed in RestDeviceProvider with ONOS in the cluster (in this example 3 nodes: OC1, OC2, OC3).
When new REST device config (netcfg) is added to OC1, it is propagated to OC2 and OC3 with distributed store. Then for example in OC2, InternalNetworkConfigListener receives new event "CONFIG_ADDED". It causes creating new thread to add new REST devices.
In that thread provider tries to obtain config subjects:
Set<DeviceId> deviceSubjects = cfgService.getSubjects(DeviceId.class, RestDeviceConfig.class);
But sometimes (approx. 30% chance) this Set is empty. I can observe it only on nodes to which the config was propagated, not on the node where config was directly added using REST API.
The fast workaround was to add "sleep 200ms" in the code before obtaining subjects and it fixed that problem.