[GH-ISSUE #432] hf3fs_cli rmtree: --help and an invalid --expire value both crash with TypeError #247

Open
opened 2026-10-26 09:47:46 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @sebxt on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/deepseek-ai/3FS/issues/432

What happens

ExpireType in hf3fs_utils/cli.py overrides click.ParamType.get_metavar with the signature get_metavar(self, param). That causes two crashes:

  1. With click 8.2 or newer (setup_hf3fs_utils.py does not pin click, so this is what a fresh install gets), hf3fs_cli rmtree --help fails. Click 8.2 calls get_metavar(param=..., ctx=...):
TypeError: ExpireType.get_metavar() got an unexpected keyword argument 'ctx'
  1. With any click version, an unsupported expire value crashes instead of printing the intended usage error, because convert calls self.get_metavar() with no arguments:
$ hf3fs_cli rmtree /some/dir --expire 2h
TypeError: ExpireType.get_metavar() missing 1 required positional argument: 'param'

What should happen

rmtree --help prints the help text, and --expire 2h exits with code 2 and the message 2h is invalid, valid options are [1h|3h|8h|1d|3d|7d].

Repro

pip install click   # 8.2 or newer for the --help case
python -m hf3fs_utils.cli rmtree --help
python -m hf3fs_utils.cli rmtree /tmp --expire 2h

Neither command needs a 3FS mount; both fail during argument parsing.

Cause

get_metavar needs to accept the ctx argument added in click 8.2, and convert needs to pass param (and ctx) when it calls it.

Originally created by @sebxt on GitHub (Oct 19, 2026). Original GitHub issue: https://github.com/deepseek-ai/3FS/issues/432 ## What happens `ExpireType` in `hf3fs_utils/cli.py` overrides `click.ParamType.get_metavar` with the signature `get_metavar(self, param)`. That causes two crashes: 1. With click 8.2 or newer (setup_hf3fs_utils.py does not pin click, so this is what a fresh install gets), `hf3fs_cli rmtree --help` fails. Click 8.2 calls `get_metavar(param=..., ctx=...)`: ``` TypeError: ExpireType.get_metavar() got an unexpected keyword argument 'ctx' ``` 2. With any click version, an unsupported expire value crashes instead of printing the intended usage error, because `convert` calls `self.get_metavar()` with no arguments: ``` $ hf3fs_cli rmtree /some/dir --expire 2h TypeError: ExpireType.get_metavar() missing 1 required positional argument: 'param' ``` ## What should happen `rmtree --help` prints the help text, and `--expire 2h` exits with code 2 and the message `2h is invalid, valid options are [1h|3h|8h|1d|3d|7d]`. ## Repro ``` pip install click # 8.2 or newer for the --help case python -m hf3fs_utils.cli rmtree --help python -m hf3fs_utils.cli rmtree /tmp --expire 2h ``` Neither command needs a 3FS mount; both fail during argument parsing. ## Cause `get_metavar` needs to accept the `ctx` argument added in click 8.2, and `convert` needs to pass `param` (and `ctx`) when it calls it.
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/3FS#247
No description provided.