@@ -397,6 +397,7 @@ async def open(
397397 store_path = await make_store_path (store )
398398
399399 consolidated_key = ZMETADATA_V2_JSON
400+
400401 if (zarr_format == 2 or zarr_format is None ) and isinstance (use_consolidated , str ):
401402 consolidated_key = use_consolidated
402403
@@ -414,9 +415,6 @@ async def open(
414415 if use_consolidated or use_consolidated is None :
415416 maybe_consolidated_metadata_bytes = rest [0 ]
416417
417- if use_consolidated and maybe_consolidated_metadata_bytes is None :
418- # the user requested consolidated metadata, but it was missing
419- raise FileNotFoundError (paths [- 1 ])
420418 else :
421419 maybe_consolidated_metadata_bytes = None
422420
@@ -453,6 +451,11 @@ async def open(
453451 if zarr_format == 2 :
454452 # this is checked above, asserting here for mypy
455453 assert zgroup_bytes is not None
454+
455+ if use_consolidated and maybe_consolidated_metadata_bytes is None :
456+ # the user requested consolidated metadata, but it was missing
457+ raise ValueError (consolidated_key )
458+
456459 return cls ._from_bytes_v2 (
457460 store_path , zgroup_bytes , zattrs_bytes , maybe_consolidated_metadata_bytes
458461 )
@@ -517,7 +520,6 @@ def _from_bytes_v3(
517520 group_metadata = json .loads (zarr_json_bytes .to_bytes ())
518521 if use_consolidated and group_metadata .get ("consolidated_metadata" ) is None :
519522 msg = f"Consolidated metadata requested with 'use_consolidated=True' but not found in '{ store_path .path } '."
520- # Use `FileNotFoundError` here to match the error from v2?
521523 raise ValueError (msg )
522524
523525 elif use_consolidated is False :
@@ -1086,7 +1088,6 @@ def _members_consolidated(
10861088 self .store_path , key , prefix = self .name
10871089 ) # Metadata -> Group/Array
10881090 key = "/" .join ([prefix , key ]).lstrip ("/" )
1089- # breakpoint()
10901091 yield key , obj
10911092
10921093 if ((max_depth is None ) or (current_depth < max_depth )) and isinstance (
0 commit comments