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

CLI: an empty numeric flag value is read as 0

Closed Beginner friendly
#3,792 1 comment 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
83/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
cli

Research direction

Start with parseFlagValue in src/cli/parser/args.ts, where the issue identifies Number(value) and the finite-number check as the cause. Compare its handling of empty input with the existing missing-value and booleanOrString behavior. Done means blank numeric flag values are rejected with the expected requires-a-value message, while valid numeric values still parse correctly.

Written by the indexing model from the issue text.

Description

bug

What happens

An int or number flag given an empty or blank value is accepted as 0. For flags with a minimum of 0, the command runs with no error:

agent-device test ./suite --retries=          # runs with retries 0
agent-device test ./suite --retries ""        # same
RETRIES= ; agent-device test ./suite --retries="$RETRIES"

The same applies to --hold-ms, --delay-ms, --pause-ms, --interval-ms, --duration-ms, --jitter-px, and --settle-quiet. For flags with a minimum of 1 or more, such as --count=, the error is Invalid count: with an empty value, which does not name the cause.

Expected

The parser refuses the flag with Flag --retries requires a value., as it already does for a missing value and for an empty booleanOrString inline value.

Cause

parseFlagValue in src/cli/parser/args.ts converts the value with Number(value) and checks only Number.isFinite. Number('') and Number(' ') are 0.

Environment

main at 6e8c2a0, Node 22.22.0, Linux.

Dominant language
TypeScript
Stars
5k
Forks
334
Avg merge
12h 13m
Merged PRs (30d)
723

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 callstack/agent-device

All issues in callstack/agent-device

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.