rescue api.client_module::ApiError => e
        if e.message.include? 'Could not find the following content units'
          raise ::Katello::Errors::Pulp3Error, "Content units that do not exist in Pulp were requested to be copied."\
             " Please run `foreman-rake katello:delete_orphaned_content` to fix the following repository:"\
            " #{repository_reference.root_repository.name}. Original error: #{e.message}"