{"id":"XE-16852","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"675","source_url":"https://github.com/xeprotocol/xe/issues/675","reporter_id":2920,"title":"[Low] Go client SDK silently converts server errors and malformed responses into empty results","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":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-17T06:41:34.303710+00:00","updated_at":"2026-11-22T23:26:11.684782+00:00","source_created_at":"2026-11-17T06:39:33+00:00","told_at":"2026-11-22T23:26:11.711586+00:00","status_changed_at":"2026-11-22T23:26:11.689649+00:00","url":"https://bounty.xe.network/XE-16852","body":"## Summary\n\nSeveral Go client SDK methods never check `resp.StatusCode` and ignore the JSON decode error, returning zero values with a nil error. A node outage, a 502, or a malformed response is indistinguishable from \"no data\" — and callers act on the empty result.\n\n## Root cause\n\n`GetBalances` (`client/client.go:63-77`), `GetPending` (`:79-91`), `GetProviders` (`:120-129`), `GetLeases` (`:143-152`), `getJSON` (`:169-178`) never check `resp.StatusCode` and ignore the decode error (`_ = json.NewDecoder(...).Decode(...)`), returning zero values with a nil error. `GetVM` (`:154-167`) additionally returns `(nil, nil)` on transport error AND on any non-200 status. Contrast `GetReputation` (`:120-136`), which checks the status code and returns decode errors — the silent pattern is inconsistent, not by design.\n\n## Verification\n\nExecuted PoC against a fake node:\n- HTTP 502 HTML page → `GetBalances` returns empty map + nil error.\n- Malformed JSON → `GetPending`/`GetLeases` return nil + nil error.\n- HTTP 500 and connection-refused → `GetVM` returns nil + nil error.\n\n## Impact (callers in `cmd/xe/main.go`)\n\n- `cmdWalletBalance` (`:647`) prints \"(no balance)\" on a 502.\n- `cmdReceive` (`:740`) prints \"No pending sends to receive.\" and returns when the node errors — a user with real pending funds is told there is nothing to receive.\n- `cmdVM` (`:1164`) fatals \"VM not found\" on a node outage, and its `err != nil` check is dead code since `GetVM` never returns an error.\n\n## Note on related reports\n\n#77 is about the **TypeScript** SDK (`src/client.ts`) + OpenAPI error-schema mismatch — different SDK, different mechanism (error-shape parsing vs no status check + swallowed decode errors). Search `GetBalances GetLeases GetVM` — 0 hits.\n\n## Suggested fix\n\nCheck `resp.StatusCode` and return decode errors in the affected methods, matching `GetReputation`.","patch_refs":[],"thread":[{"id":18796,"source":"desk","source_ref":"reply:16473","author":"Joseph Denne","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-16852 and says what differs; it is read like any other.","created_at":"2026-11-22T23:26:11.684782+00:00"}]}