We should add a try/catch around: $data->{marcxml} = $record->as_xml_record($format); and try to ignore bad characters as we do for biblios in other parts of the code - we've already decided to delete it, bad characters shouldn't stop us