protected void handleFetchFailure(final Node fetchTarget,
                                      final FetchSessionHandler.FetchRequestData data,
                                      final Throwable t) {
        try {
            final FetchSessionHandler handler = sessionHandler(fetchTarget.id());

            if (handler != null) {
                handler.handleError(t);
                handler.sessionTopicPartitions().forEach(subscriptions::clearPreferredReadReplica);
            }
        } finally {
            removePendingFetchRequest(fetchTarget, data.metadata().sessionId());
        }
    }
Implements the core logic for a failed fetch response.

@param fetchTarget {@link Node} from which the fetch data was requested
@param data        {@link FetchSessionHandler.FetchRequestData} from request
@param t           {@link Throwable} representing the error that resulted in the failure
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java