Skip to content

fix: prevent 0 value for max-concurrency and threads#2145

Merged
mre merged 2 commits into
lycheeverse:masterfrom
rina-forks:nonzeruusize
Apr 16, 2026
Merged

fix: prevent 0 value for max-concurrency and threads#2145
mre merged 2 commits into
lycheeverse:masterfrom
rina-forks:nonzeruusize

Conversation

@katrinafyi

Copy link
Copy Markdown
Member

Using NonZeroUsize means we get nice error messages automatically from clap.

error: invalid value '0' for '--max-concurrency <MAX_CONCURRENCY>': number would be zero for non-zero type

For more information, try '--help'.

Unfortunately, the error is more cryptic when using a zero in the toml:

[ERROR] Error while loading config: Cannot load configuration file: lychee.toml
See: https://github.com/lycheeverse/lychee/blob/lychee-v0.23.0/lychee.example.toml

Fixes #2141

Using NonZeroUsize means we get nice error messages automatically from
clap.

    error: invalid value '0' for '--max-concurrency <MAX_CONCURRENCY>': number would be zero for non-zero type

    For more information, try '--help'.

Unfortunately, the error is more cryptic when using a zero in the toml:

    [ERROR] Error while loading config: Cannot load configuration file: lychee.toml
    See: https://github.com/lycheeverse/lychee/blob/lychee-v0.23.0/lychee.example.toml

Fixes lycheeverse#2141
@katrinafyi katrinafyi changed the title fix: use NonZeroUsize for max-concurrency and threads fix: prevent 0 value for max-concurrency and threads Apr 16, 2026
@mre

mre commented Apr 16, 2026

Copy link
Copy Markdown
Member

Love it! Thanks for the fix!

@mre mre merged commit b0dcbfd into lycheeverse:master Apr 16, 2026
7 checks passed
@mre mre mentioned this pull request Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic on --max-concurrency=0

2 participants