An islandora object was not being loaded in time for a call to drupal_set_message to have access to it. I have moved its loading to an earlier part in the code.