The error often occurs when the topic owner changes or the namespace bundle is being unloaded. The logs for the broker will show further details of why the unit it’s ready. For instance, it could be something like:
Namespace bundle for topic not served by this instance. Please redo the lookup.
So for the client side, instead of exposing ServiceUnitNotReady to users, it should do the topic lookup again.
However, the ServiceUnitNotReady error doesn’t always point to a temporary error, like a change in the namespace bundle ownership. Sometimes, the Pulsar proxy can transfer all errors, including authentication errors, into the ServiceUnitNotReady error. Similarly, the broker could also return the same error when the listener name isn’t correct. So to understand the real cause of the problem, you should check both the client’s and the broker’s logs.