code: private <R> R tryTwice(Supplier<R> action) {
      try {
        return action.get();
      } catch (UnknownIndexException e) {
        waitForIndexToBeStable();
        try {
          return action.get();
        } catch (UnknownIndexException e1) {
          throw new MolgenisDataException(
              format(
                  "Error executing query, index for entity type '%s' with id '%s' does not exist",
                  getEntityType().getLabel(), getEntityType().getId()));
        }
      }
    }
docs: Executes an action on an index that may be unstable.
  
  <p>If the Index was unknown, waits for the index to be stable and then tries again.
  
  @param action the action that gets executed
  @param <R> the result type of the action
  @return the result
  @throws MolgenisDataException if the action still failed when the index was stable, with a
  translated error message.