{"id":"XE-7492","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":1727,"title":"CLI subcommands do not implement --help: the flag is treated as a normal argument (and some commands then hit the network)","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-1248","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-11T17:46:13.775217+00:00","updated_at":"2026-11-17T09:42:07.676510+00:00","source_created_at":null,"told_at":"2026-11-17T09:42:07.701054+00:00","status_changed_at":"2026-11-17T09:42:07.683630+00:00","url":"https://bounty.xe.network/XE-7492","body":"- **Target:** XE CLI (`xe` binary) shipped in https://github.com/xeprotocol/xe (`cmd/xe`)\r\n- **Area:** SDK / docs / web\r\n- **Claimed severity:** Minor (650 XE ceiling) — CLI UX / misleading usage; one path performs a live API call\r\n- **Observed:** 12 Nov 2026, 00:41–00:44 WIB (11 Nov 2026, 17:41–17:44 UTC)\r\n- **Network / binary:** testnet-0005; built from official HEAD `89a542e` (`release: testnet-0005 quorum withhold fix`), `GOTOOLCHAIN=local`, reported as `xe local-research`\r\n\r\n## Summary\r\n\r\nOnly the top-level invocation `xe help` / `xe --help` / `xe -h` prints usage. Every subcommand I tried, except `verify-genesis`, treats `--help` or `-h` as an ordinary argument:\r\n\r\n- `xe wallet --help` → `unknown wallet command: --help`\r\n- `xe chat --help` → `unknown chat command: --help`\r\n- `xe send --help` → `usage: xe send <address> <amount> [--asset XUSD]` (and `--help` never reaches a help path)\r\n- `xe receive` / `faucet` / `mint` / `burn` / `lease --help` → skip help and start the command; without a wallet they fail with `no wallet found at … — run: xe wallet create`\r\n- `xe providers --help` and `xe providers -h` → **ignore the flag and call the live node**, then print the provider list\r\n- `xe vm --help` → `error: VM not found for lease --help` (the flag is used as a lease hash)\r\n- `xe ssh --help` → looks up a lease SSH key\r\n- `xe directory --help` → `usage: xe directory register [--watch]`\r\n- `xe sign-block --help` → `sign-block no longer takes a seed argument … rotate this seed and set XE_SEED instead` (the help flag is classified as a positional seed)\r\n- `xe help wallet` (and any other `xe help <command>`) → prints the full top-level usage and ignores the command name\r\n- `xe verify-genesis --help` is the exception: it uses `flag.NewFlagSet` and prints flag help\r\n\r\nThe official docs say `./xe --help` prints the command list, which is true, but a user who reasonably asks a subcommand for help either gets an error, a usage string that is not help, a warning to rotate a seed, or a live network request.\r\n\r\n## Steps to reproduce\r\n\r\nBuild the official CLI from `github.com/xeprotocol/xe` at `89a542e` (or any current HEAD that still has the `switch` in `cmd/xe/main.go` with `help` handled only as a top-level command). No wallet is required.\r\n\r\n```bash\r\n./xe --help                  # works (usage on stderr; see also XE-7346)\r\n./xe wallet --help           # error: unknown wallet command: --help\r\n./xe chat --help             # error: unknown chat command: --help\r\n./xe send --help             # error: usage: xe send <address> <amount> [--asset XUSD]\r\n./xe faucet --help           # error: no wallet found … (command started)\r\n./xe providers --help        # prints the live provider list; exit 0\r\n./xe providers -h            # same live list\r\n./xe vm --help               # error: VM not found for lease --help\r\n./xe sign-block --help       # error: … rotate this seed and set XE_SEED instead\r\n./xe help wallet             # full top-level usage, not wallet help\r\n./xe verify-genesis --help   # works\r\n```\r\n\r\nTo confirm the providers path really hits the network, leave `XE_NODE` at its default (`https://ldn.core.test.network`) and compare the printed rows with `GET /providers`.\r\n\r\n## Evidence\r\n\r\nObserved 12 Nov 2026 00:41–00:43 WIB against the binary built as above, default `XE_NODE=https://ldn.core.test.network`, no `XE_WALLET` and no seed file at `~/.xe/wallet.seed`.\r\n\r\n`xe providers --help` and `xe providers -h` both exited 0 and printed four providers (addresses truncated here as the CLI already truncates them):\r\n\r\n```\r\n[1] 26740934...6c56c06b\r\n    Total: 4 vCPU, 8192 MB, 50 GB\r\n    …\r\n[4] f90fa879...2b289ccb\r\n    Total: 4 vCPU, 8192 MB, 50 GB\r\n    …\r\n```\r\n\r\nThat listing matches a contemporaneous `GET https://ldn.core.test.network/providers` (four entries).\r\n\r\nSource, `cmd/xe/main.go`: `main()` sets `cmd := os.Args[1]` and `args := os.Args[2:]`, then switches on `cmd`. The `help` / `--help` / `-h` case is only taken when those tokens are `os.Args[1]`. Subcommands do not inspect `args` for a help flag before running. In particular:\r\n\r\n- `case \"providers\":` calls the list command with no flag check (line 90).\r\n- `case \"vm\":` requires an argument and passes `args[0]` through as the lease hash, so `--help` becomes a hash (line 106).\r\n- `case \"sign-block\":` if `len(args) >= 1`, fatals with the \"rotate this seed\" message (line 128), so `--help` is treated as a seed.\r\n- `case \"wallet\":` / chat: a non-matching first arg is `unknown … command: %s`.\r\n- `case \"send\":` if `len(args) < 2`, fatals the usage string; `--help` is a single argument, so this path fires.\r\n- `case \"verify-genesis\":` delegates to `flag.NewFlagSet(\"verify-genesis\", …)`, which is why that command alone prints help.\r\n\r\n## Impact\r\n\r\n- Users cannot get per-command help from the usual flag.\r\n- `xe providers --help` and `xe providers -h` perform an unsolicited request to the configured node (the public London testnet node, by default).\r\n- `xe faucet --help` would start a faucet request if a wallet file were present (not exercised here; without a wallet it already enters `cmdFaucet` far enough to demand the seed file).\r\n- `xe sign-block --help` tells the operator to rotate a seed they did not pass.\r\n- `xe vm --help` probes the node for a lease named `--help`.\r\n\r\nNo funds, keys, or other users were involved. Severity is Minor: this is CLI usage handling, not a protocol break.\r\n\r\n## Suggested fix\r\n\r\nBefore dispatching each subcommand, honour `--help` / `-h` (or use a `flag.FlagSet` per command, as `verify-genesis` already does). `xe help <command>` should print that command's usage, not the top-level list. `providers`, `faucet`, `vm`, and `sign-block` must not run their live action when the only argument is a help flag.\r\n\r\n## Dedup\r\n\r\nChecked all **1,290 public** bounty tickets (`GET /v1/tickets?kind=bounty&status=all`, refreshed 12 Nov 2026 00:40 WIB). No public title covers subcommand `--help` being ignored, `unknown wallet command: --help`, `providers --help` hitting the node, or `vm --help` being used as a lease hash.\r\n\r\nNearby tickets that are **not** the same bug:\r\n\r\n- XE-7346 — top-level `xe --help` / `xe help` write usage to stderr instead of stdout. That path works; this report is about subcommands never taking it.\r\n- XE-5984 — top-level help text says a positional `sign-block` seed \"still works\", but the binary rejects it. Related only in that `sign-block --help` hits that same rejection path.\r\n- XE-5669 — `xe faucet` help text says XUSD; it is about the wording of the top-level usage line, not about `--help` being ignored.\r\n- XE-7347 — `xe keygen` silently ignores trailing arguments; a sibling of \"flags not parsed\", but not help handling.\r\n- XE-0086 — `xe send` defaults to XUSD; the usage string shown when `send --help` fails is a symptom of missing help, not the default-asset bug.\r\n\r\n**Caveat:** only public tickets can be searched. A sealed private ticket could already cover this. Duplicates go to the first verifiable submission.\r\n\r\n## Method\r\n\r\nBuilt the official CLI on the box and ran the help invocations above. `xe providers --help` was a single ordinary client listing (the same call `xe providers` makes). No wallet was created, no seed was printed, no funds were sent, no faucet grant was requested, no volume test.","patch_refs":[],"thread":[{"id":9878,"source":"desk","source_ref":"reply:8316","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-1248, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-7492 and says what differs; it is read like any other.","created_at":"2026-11-17T09:42:07.676510+00:00"}]}