From c1a88c7ceda45935ede571641f826dcf1979b8ee Mon Sep 17 00:00:00 2001
From: David McKenna <mckenna@astron.nl>
Date: Wed, 4 Jun 2025 16:25:18 +0200
Subject: [PATCH] FIX: Only error if data is present and metadata is missing

---
 l2json/sources/minio.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/l2json/sources/minio.py b/l2json/sources/minio.py
index 424b56d..47dd725 100644
--- a/l2json/sources/minio.py
+++ b/l2json/sources/minio.py
@@ -176,9 +176,13 @@ def fetch_from_minio(
                 tqdm_desc="Parsing metadata",
             )
         ]
-        if not len(metadata):
-            raise KeyError(f"No metadata was found for {station}/{statistics_type}/{antennafield} @ {tstart} - {tend}")
     else:
         metadata = []
 
+    if fetch_metadata and not len(metadata):
+        if len(data):
+            raise KeyError(f"No metadata was found for {station}/{statistics_type}/{antennafield} @ {tstart} - {tend}")
+        else:
+            print(f"No metadata was found for {station}/{statistics_type}/{antennafield} @ {tstart} - {tend}")
+
     return metadata, data
-- 
GitLab