Program: 164540
Project: 164540
Buggy source:
private Result<Pair<TicketReservation,List<Ticket>>> createReservation(Result<Pair<TicketsInfo,TicketCategory>> input,Event event,AdminReservationModification arm){
  return input.flatMap(t -> {
    TicketCategory category=t.getRight();
    TicketsInfo ticketsInfo=t.getLeft();
    String reservationId=UUID.randomUUID().toString();
    String specialPriceSessionId=UUID.randomUUID().toString();
    Date validity=Date.from(arm.getExpiration().toZonedDateTime(event.getZoneId()).toInstant());
    ticketReservationRepository.createNewReservation(reservationId,validity,null,arm.getLanguage());
    AdminReservationModification.CustomerData customerData=arm.getCustomerData();
    ticketReservationRepository.updateTicketReservation(reservationId,TicketReservationStatus.PENDING.name(),customerData.getEmailAddress(),customerData.getFullName(),customerData.getFirstName(),customerData.getLastName(),arm.getLanguage(),null,null,null);
    int categoryId=category.getId();
    List<Attendee> attendees=ticketsInfo.getAttendees();
    List<Integer> reservedForUpdate=ticketReservationManager.reserveTickets(event.getId(),categoryId,attendees.size(),singletonList(Ticket.TicketStatus.FREE));
    if (reservedForUpdate.size() != attendees.size()) {
      return Result.error(ErrorCode.CategoryError.NOT_ENOUGH_SEATS);
    }
    ticketRepository.reserveTickets(reservationId,reservedForUpdate,categoryId,arm.getLanguage(),category.getSrcPriceCts());
    Ticket ticket=ticketRepository.findById(reservedForUpdate.get(0),categoryId);
    TicketPriceContainer priceContainer=TicketPriceContainer.from(ticket,event,null);
    ticketRepository.updateTicketPrice(reservedForUpdate,categoryId,event.getId(),category.getSrcPriceCts(),MonetaryUtil.unitToCents(priceContainer.getFinalPrice()),MonetaryUtil.unitToCents(priceContainer.getVAT()),MonetaryUtil.unitToCents(priceContainer.getAppliedDiscount()));
    List<SpecialPrice> codes=category.isAccessRestricted() ? bindSpecialPriceTokens(specialPriceSessionId,categoryId,attendees) : Collections.emptyList();
    assignTickets(attendees,reservedForUpdate,codes,reservationId,arm.getLanguage(),category.getSrcPriceCts());
    List<Ticket> tickets=reservedForUpdate.stream().map(id -> ticketRepository.findById(id,categoryId)).collect(toList());
    return Result.success(Pair.of(ticketReservationRepository.findReservationById(reservationId),tickets));
  }
);
}

Fixed version (ground truth):
private Result<Pair<TicketReservation,List<Ticket>>> createReservation(Result<List<TicketsInfo>> input,Event event,AdminReservationModification arm){
  final TicketsInfo empty=new TicketsInfo(null,null,false,false);
  return input.flatMap(t -> {
    String reservationId=UUID.randomUUID().toString();
    String specialPriceSessionId=UUID.randomUUID().toString();
    Date validity=Date.from(arm.getExpiration().toZonedDateTime(event.getZoneId()).toInstant());
    ticketReservationRepository.createNewReservation(reservationId,validity,null,arm.getLanguage());
    AdminReservationModification.CustomerData customerData=arm.getCustomerData();
    ticketReservationRepository.updateTicketReservation(reservationId,TicketReservationStatus.PENDING.name(),customerData.getEmailAddress(),customerData.getFullName(),customerData.getFirstName(),customerData.getLastName(),arm.getLanguage(),null,null,null);
    Result<List<Ticket>> result=flattenTicketsInfo(event,empty,t).map(pair -> reserveForTicketsInfo(event,arm,reservationId,specialPriceSessionId,pair)).reduce(this::reduceReservationResults).orElseGet(() -> Result.error(ErrorCode.custom("String_Node_Str","String_Node_Str")));
    return result.map(list -> Pair.of(ticketReservationRepository.findReservationById(reservationId),list));
  }
);
}