<!-- XE-16852 · [Low] Go client SDK silently converts server errors and malformed responses into empty results · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16852>. The page is the record; this is the same page for reading.*

XE-16852 · Bounty

# \[Low\] Go client SDK silently converts server errors and malformed responses into empty results

Closed · duplicate
—
[xe#675](https://github.com/xeprotocol/xe/issues/675)
filed 2026-11-17 06:39 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   —

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770132](https://bounty.xe.network/log/770132) 2026-11-22 23:26 UTC reply.mirror\_failed
- [769821](https://bounty.xe.network/log/769821) 2026-11-22 23:26 UTC proposal.adopted
- [769820](https://bounty.xe.network/log/769820) 2026-11-22 23:26 UTC reply.sent
- [769819](https://bounty.xe.network/log/769819) 2026-11-22 23:26 UTC proposal.adopted
- [769818](https://bounty.xe.network/log/769818) 2026-11-22 23:26 UTC ticket.status new → closed
- [768753](https://bounty.xe.network/log/768753) 2026-11-22 23:25 UTC proposal.adopted
- [768752](https://bounty.xe.network/log/768752) 2026-11-22 23:25 UTC ticket.facts area
- [768751](https://bounty.xe.network/log/768751) 2026-11-22 23:25 UTC proposal.adopted
- [768750](https://bounty.xe.network/log/768750) 2026-11-22 23:25 UTC ticket.facts
- [768749](https://bounty.xe.network/log/768749) 2026-11-22 23:25 UTC proposal.adopted
- [768748](https://bounty.xe.network/log/768748) 2026-11-22 23:25 UTC ticket.facts
- [766691](https://bounty.xe.network/log/766691) 2026-11-22 23:18 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-16852) · [JSON](https://bounty.xe.network/v1/tickets/XE-16852) · [markdown](https://bounty.xe.network/XE-16852.md)

### Report

## Summary

Several 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.

## Root cause

`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.

## Verification

Executed PoC against a fake node:

- HTTP 502 HTML page → `GetBalances` returns empty map \+ nil error.
- Malformed JSON → `GetPending`/`GetLeases` return nil \+ nil error.
- HTTP 500 and connection-refused → `GetVM` returns nil \+ nil error.

## Impact (callers in `cmd/xe/main.go`)

- `cmdWalletBalance` (`:647`) prints "(no balance)" on a 502\.
- `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.
- `cmdVM` (`:1164`) fatals "VM not found" on a node outage, and its `err != nil` check is dead code since `GetVM` never returns an error.

## Note on related reports

#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.

## Suggested fix

Check `resp.StatusCode` and return decode errors in the affected methods, matching `GetReputation`.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-16852 and says what differs; it is read like any other.
