diff --git a/src/v/cloud_storage/remote_partition.cc b/src/v/cloud_storage/remote_partition.cc index bfc8a851b93e..bc4b0c6a96f6 100644 --- a/src/v/cloud_storage/remote_partition.cc +++ b/src/v/cloud_storage/remote_partition.cc @@ -524,24 +524,30 @@ class partition_record_batch_reader_impl final if ( cur.error() == error_outcome::out_of_range - && std::holds_alternative(query)) { - // Special case queries below the start offset of the log. - // The start offset may have advanced while the request was - // in progress. This is expected, so log at debug level. - const auto log_start_offset = _partition->_manifest_view - ->stm_manifest() - .full_log_start_kafka_offset(); - - const auto query_offset = std::get(query); - if (log_start_offset && query_offset < *log_start_offset) { - vlog( - _ctxlog.debug, - "Manifest query below the log's start Kafka offset: {} < " - "{}", - query_offset(), - log_start_offset.value()()); - co_return; - } + && ss::visit( + query, + [&](kafka::offset query_offset) { + // Special case queries below the start offset of the log. + // The start offset may have advanced while the request was + // in progress. This is expected, so log at debug level. + const auto log_start_offset + = _partition->_manifest_view->stm_manifest() + .full_log_start_kafka_offset(); + + if (log_start_offset && query_offset < *log_start_offset) { + vlog( + _ctxlog.debug, + "Manifest query below the log's start Kafka offset: " + "{} < {}", + query_offset(), + log_start_offset.value()()); + return true; + } + return false; + }, + [](auto) { return false; })) { + // error was handled + co_return; } vlog(