Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Invalid --chunks/--shards arguments to b2nd-to-zarr deletes destination with --force

Open Beginner friendly
#731 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
data

Research direction

Start by locating the b2nd-to-zarr command implementation and tracing where it removes the destination with --force relative to its call to zarr.create_array. Reproduce the failure using the shell commands in the issue, including --chunks 30 --shards 50 --force. Done means invalid arguments no longer cause the existing destination to disappear when conversion fails.

Written by the indexing model from the issue text.

Description

Describe the bug
If a user creates a .zarr file using b2nd-to-zarr, then subsequently calls b2nd-to-zarr again with arguments to --chunks and --shards that are invalid, meaning shards % chunks != 0, then b2nd-to-zarr will call shutil.rmtree(dst_path) first and then call zarr.create_array which will fail. I think ideally the converter should throw an error before reaching zarr.create_array about invalid arguments to --chunks and --shards.

To Reproduce
Steps to reproduce the behavior:

Shell commands:

  python -c "import blosc2, numpy as np; blosc2.asarray(np.arange(1000), urlpath='data.b2nd', mode='w')"
  b2nd-to-zarr data.b2nd good.zarr -q && ls good.zarr
  b2nd-to-zarr data.b2nd good.zarr --chunks 30 --shards 50 --force

Output:

Error: Chunk edge length 50 in dimension 0 is not divisible by the shard's inner chunk size 30.

Then

  ls good.zarr

produces

ls: good.zarr: No such file or directory

Expected behavior
good.zarr should still exist even if the converter fails

Desktop:

  • OS: Mac OS Tahoe
  • Version 26.7

Additional context
I think one additional option besides throwing an earlier error message could be writing to a temporary path and then renaming it after success

Dominant language
Python
Stars
211
Forks
66
Avg merge
2d 1h
Merged PRs (30d)
15

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Blosc/python-blosc2

All issues in Blosc/python-blosc2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.