Some of the calling code inside of rice that calls the UIDocumentServiceImpl.getMember() method handles a null return value. Other times this is not handled. Currently a NullPointerException is occuring in KC - see the linked issue for details.
In KC's case when have a role with members that do not exist. This is analogous to a fk constraint violation if a constraint did exist (which it cannot). So, cleaning up our kim data should fix this problem.
As for the rice code, it would be nice if not found members were handled consistently. Maybe a warning/error to the maintenance screen with the option of removing the invalid entry. Maybe throwing a more useful exception. Just ideas.