Skip to content

zarr.group raises FileNotFoundError #3406

Closed

Description

@K-Meech

Zarr version

latest main

Numcodecs version

v0.16.1

Python Version

3.13

Operating System

Windows

Installation

pip install into a virtual environment

Description

On the latest main branch, zarr.group raises a FileNotFoundError when creating a new group - see example code below.

Error:

File "C:\Users\kimme\Documents\Repos\forked\zarr-python\src\zarr\storage\_common.py", line 361, in make_store_path
    store = await LocalStore.open(root=store_like, mode=mode)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\kimme\Documents\Repos\forked\zarr-python\src\zarr\storage\_local.py", line 142, in open
    await store._open()
  File "C:\Users\kimme\Documents\Repos\forked\zarr-python\src\zarr\storage\_local.py", line 154, in _open
    raise FileNotFoundError(f"{self.root} does not exist")
FileNotFoundError: data\example.zarr does not exist

Steps to reproduce

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
#
# This script automatically imports the development branch of zarr to check for issues

import zarr
root = zarr.group('data/example.zarr')

Additional output

No response

Activity

  1. added
    bugPotential issues with the zarr-python library
    on Aug 26, 2025
  2. d-v-b commented on Aug 26, 2025

    @d-v-b
    Contributor

    can you test this with 3.1.1? I wonder if somehow this slipped in via #3307

  3. K-Meech commented on Aug 26, 2025

    @K-Meech
    ContributorAuthor

    I tried with 3.1.1 and there is no error raised there.

  4. dstansby commented on Aug 26, 2025

    @dstansby
    Contributor

    😬 thanks for uncovering this, and it's not great that we don't test for it!

    My PR seems to have uncovered an issue in how groups are created; I believe this is the fix, but I don't have time to write a test that fails before the change at the moment, so others please feel free to open a PR with the fix and a test!

    diff --git a/src/zarr/api/asynchronous.py b/src/zarr/api/asynchronous.py
    index fdbd3b34..55249236 100644
    --- a/src/zarr/api/asynchronous.py
    +++ b/src/zarr/api/asynchronous.py
    @@ -677,7 +677,7 @@ async def group(
         if overwrite:
             mode = "w"
         else:
    -        mode = "r+"
    +        mode = "w-"
         store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
     
         if chunk_store is not None:
  5. d-v-b commented on Sep 2, 2025

    @d-v-b
    Contributor

    @dstansby I posted a PR with your proposed change, and some tests, here: #3426. Unfortunately, fixing this particular bug triggers test failures elsewhere in the codebase. Store permissions really is the gift that keeps on giving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions