Sep31Invalid Response Exception
Exception thrown when the Receiving Anchor returns a malformed response.
Raised when the anchor responded with an otherwise-successful HTTP status (200 or
but the response body could not be parsed or was missing fields the SEP-31 spec marks as required. Common triggers:
The response body is not syntactically valid JSON
The response Content-Type is neither
application/jsonnorapplication/problem+jsonA required field is absent (for example,
idonSep31PostTransactionsResponse)The
GET /transactions/:idresponse is not wrapped in the spec-mandated{"transaction": {...}}envelopeThe response exceeds the SDK's size cap (2 MB for
/info, 256 KB for transaction responses)
The statusCode defaults to 200 because this exception only fires on a syntactically bad response inside an otherwise-successful HTTP status.
Recovery actions:
Verify the configured
DIRECT_PAYMENT_SERVERURL points to a SEP-31 compliant anchorContact the Receiving Anchor operator if the failure persists
Example - Handle invalid response:
try {
val info = sep31Service.info(jwt = jwt)
} catch (e: Sep31InvalidResponseException) {
println("Malformed anchor response (HTTP ${e.statusCode}): ${e.message}")
}See also:
Sep31Exception base class
Parameters
Sanitized error message describing the parsing failure.
Properties
Anchor response body for local debugging — see the rawResponseBody convention on Sep31Exception. null when no body was captured (for example, content-type rejection before any body was read).
The HTTP status code that produced the malformed body (defaults to 200).