diff --git a/src/modules/logger/logger.cpp b/src/modules/logger/logger.cpp
index 460be62dbf8fcab35c1d9dfbebb8863aa466f16d..69c8d1a81c8f4967d06b4fd7be631d8e3f1074b4 100644
--- a/src/modules/logger/logger.cpp
+++ b/src/modules/logger/logger.cpp
@@ -1752,7 +1752,12 @@ void Logger::write_add_logged_msg(LoggerSubscription &subscription, int instance
 {
 	ulog_message_add_logged_s msg;
 
-	if (subscription.msg_ids[instance] == (uint16_t) - 1) {
+	if (subscription.msg_ids[instance] == (uint8_t) - 1) {
+		if (_next_topic_id == (uint8_t) - 1) {
+			// if we land here an uint8 is too small -> switch to uint16
+			PX4_ERR("limit for _next_topic_id reached");
+			return;
+		}
 		subscription.msg_ids[instance] = _next_topic_id++;
 	}
 
diff --git a/src/modules/logger/logger.h b/src/modules/logger/logger.h
index 38db9c924dc8b828a44b564b66fe332463457063..f0bae107d258b7a7d678843cb5c9c64d09769859 100644
--- a/src/modules/logger/logger.h
+++ b/src/modules/logger/logger.h
@@ -75,8 +75,8 @@ inline bool operator&(SDLogProfileMask a, SDLogProfileMask b)
 struct LoggerSubscription {
 	int fd[ORB_MULTI_MAX_INSTANCES]; ///< uorb subscription. The first fd is also used to store the interval if
 	/// not subscribed yet (-interval - 1)
-	uint16_t msg_ids[ORB_MULTI_MAX_INSTANCES];
 	const orb_metadata *metadata = nullptr;
+	uint8_t msg_ids[ORB_MULTI_MAX_INSTANCES];
 
 	LoggerSubscription() {}
 
@@ -90,7 +90,7 @@ struct LoggerSubscription {
 		}
 
 		for (int i = 0; i < ORB_MULTI_MAX_INSTANCES; i++) {
-			msg_ids[i] = (uint16_t) - 1;
+			msg_ids[i] = (uint8_t) - 1;
 		}
 	}
 };
@@ -330,7 +330,7 @@ private:
 	uint32_t					_log_interval{0};
 	const orb_metadata				*_polling_topic_meta{nullptr}; ///< if non-null, poll on this topic instead of sleeping
 	orb_advert_t					_mavlink_log_pub{nullptr};
-	uint16_t					_next_topic_id{0}; ///< id of next subscribed ulog topic
+	uint8_t						_next_topic_id{0}; ///< id of next subscribed ulog topic
 	char						*_replay_file_name{nullptr};
 	bool						_should_stop_file_log{false}; /**< if true _next_load_print is set and file logging
 											will be stopped after load printing */