{"id":"XE-0684","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"268","source_url":"https://github.com/xeprotocol/xe/issues/268","reporter_id":7,"title":"`xe providers` prints 'No providers found.' when the node errors, and exits 0","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"closed","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-05T11:39:59.295862+00:00","updated_at":"2026-11-14T22:55:20.065660+00:00","source_created_at":"2026-11-05T11:38:46+00:00","told_at":"2026-11-14T22:54:10+00:00","status_changed_at":"2026-11-08T20:32:08.914637+00:00","url":"https://bounty.xe.network/XE-0684","body":"Suggested severity tier: Info\n\nArea: CLI provider listing and HTTP client error handling, cmd/xe/main.go (cmdProviders), client/client.go (GetProviders)\n\nRepository state checked: xeprotocol/xe HEAD 978785929bc17a2f4ab30c383e5fc9cf4d634512\n\n## Summary\n\n`xe providers` cannot tell the difference between an empty provider list and a node that failed to answer. GetProviders ignores the HTTP status code and any decode error, and cmdProviders treats any error the same as an empty list: it prints \"No providers found.\" and exits 0. An operator whose node is down, returning 500, or unreachable reads the output as \"the market is empty\" instead of \"the node is broken\".\n\n## What was proven\n\nGetProviders in client/client.go ignores the HTTP status and the decode error, and returns whatever it decoded. cmdProviders in cmd/xe/main.go treats an error from GetProviders as an empty list, prints \"No providers found.\", and exits with status 0.\n\nProven against a local build of the CLI plus a local stub node: the stub returned HTTP 500 with an HTML body for GET /providers. Running `xe providers` printed \"No providers found.\" and exited 0. The same family of misleading message exists in two sibling commands: cmdVM prints \"VM not found\" and cmdLeaseStatus prints \"lease not found\" when the node returns 500, because GetVM and the shared getJSON helper return nil, nil for errors and non-200 responses.\n\n## Reproduction\n\n1. Clone https://github.com/xeprotocol/xe and confirm HEAD is 978785929bc17a2f4ab30c383e5fc9cf4d634512.\n2. Build the CLI from source and point it at a node or stub that returns HTTP 500 for GET /providers.\n3. Run `xe providers` and observe \"No providers found.\" with exit code 0.\n\n## Impact\n\nNo funds move and no state changes. The damage is a wrong operational decision: an operator concludes the marketplace is empty and may stop, misdiagnose, or report a market problem, while the real problem is a failing node. Diagnosis is delayed because the command reports success.\n\n## Suggested fix\n\nReturn the HTTP status and decode errors from GetProviders, and make cmdProviders print an error and exit non-zero when the request fails, keeping \"No providers found.\" only for a successful empty response. Apply the same treatment to GetVM and the shared getJSON helper so the sibling commands stop reporting \"not found\" for server errors.\n\n## Honest limits of this proof\n\nThe proof ran against a local build and a local stub node returning HTTP 500. It does not involve the public testnet. The sibling variants (cmdVM, cmdLeaseStatus) were read from code, not executed against the stub.","patch_refs":[{"id":310,"repo":"xeprotocol/xe","kind":"pr","ref":"286","title":"fix(cli,client,chat,node,api): harden CLI flag parsing, provider errors, chat PoW bounds, marketplace rate-limit, and API pagination","url":"https://github.com/xeprotocol/xe/pull/286","note":"","state":"open","author":"Khanhtnq","added_by":"desk","created_at":"2026-11-06T12:42:47.419656+00:00"}],"thread":[{"id":761,"source":"github","source_ref":"6716868681","author":"rusdiwireng","team":false,"body":"Thanks for the fix in PR #286 — I reviewed it locally against the PR code, and it closes the paths named in this issue (cmdProviders, cmdLeaseStatus, cmdVM now fail loudly when the client errors). Three legs in the same area are still open, all with the same root cause (the caller swallows the error and then prints a misleading \"not found\" message):\n\n1. cmdSSH (cmd/xe/main.go:1175): `lease, _ := c.GetLease(leaseHash)`, then fatal \"lease not found\" when the lease is nil. A node error (for example HTTP 500) is still reported as the lease not existing.\n\n2. pickProvider (cmd/xe/main.go:1720): `providers, _ := c.GetProviders()`, then fatal \"no providers found\" when the list is empty. Reached through `xe lease` without --provider. A node error is still reported with the exact message this issue is about.\n\n3. GetBalances and GetPending (client/client.go:61-88): PR #286 does not touch either one. Both still ignore the HTTP status and decode errors and return an empty map / nil with a nil error. Verified with a local stub returning HTTP 500: `xe balance` prints \"(no balance)\" and `xe receive` prints \"No pending sends to receive.\", both with exit 0, while the node is actually erroring.","created_at":"2026-11-08T03:46:06+00:00"},{"id":1544,"source":"github","source_ref":"6730872623","author":"rusdiwireng","team":false,"body":"Hi, thanks for triaging. I am asking for a re-check of the duplicate closure on this issue. The nearest earlier report I can identify in the public tracker is #197 (fixed by PR #203), and this report covers client methods and CLI commands that PR #203 did not touch.\n\nConcrete difference from #197 (as documented in PR #203's public body, since #197 itself is not retrievable from the public API):\n\n- PR #203's fix covers `GetChain`, `GetBalances`, `GetPending`, and `getJSON`, plus `cmdSend`, `cmdReceive`, `cmdMint`, `cmdBurn`, and `cmdLease` — the send path, where a discarded error led to a staged conflict and a frozen account.\n- This report is about `GetProviders` and `GetVM` plus `cmdProviders`, `cmdVM`, and `cmdLeaseStatus` — none of which PR #203 touches. The user-visible symptom is also different: `xe providers` prints \"No providers found.\" and exits 0 when the node returns HTTP 500, so an operator reads a broken node as an empty market. That path was only closed later, by a separate change in PR #286 §2 (\"Fixes #268\").\n\nI agree the root-cause family is the same (the Go client ignoring HTTP status codes, and CLI commands swallowing the error). My point is narrower: the functions, commands, symptom, and fix are all different from #197's, and no public issue before #268 mentions the \"No providers found.\" behaviour at all.\n\nOne honest caveat: I cannot see the duplicate target, and #197 itself returns 404 from the public API, so I am arguing from PR #203's published scope. If this was closed as a duplicate of a desk entry that already covered `GetProviders`/`cmdProviders` specifically, please point me to it and I will withdraw this appeal. If it was closed as a duplicate of #197, I ask that it be reconsidered on the scope difference above.\n\nThank you for re-checking.","created_at":"2026-11-09T02:35:04+00:00"},{"id":3794,"source":"github","source_ref":"6885492182","author":"XE desk","team":true,"body":"Thanks. This is the same finding as an earlier report that is not public, 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-0684 and says what differs; it is read like any other.","created_at":"2026-11-14T22:54:10+00:00"}]}