Documentation / guides
Transport errors
Distinguish request construction, network, bounded-body, and HTTP status failures.
transport.Client performs pre-I/O binding and model checks, builds a fresh
request, authorizes it, and maps the HTTP result. It never retries or replays a
single-shot body.
Construction
RequestBuildError wraps router or net/http request construction failures.
ModelMismatchError rejects a non-empty request provider, base URL, or format
that conflicts with the bound endpoint. UnsupportedStreamingError is returned
before I/O when no stream decoder exists. These are not NetworkError values.
response, err := client.Invoke(ctx, req)
if err != nil {
var buildErr *transport.RequestBuildError
if errors.As(err, &buildErr) {
// Fix route or model binding; do not retry as a network failure.
}
return err
}
_ = response
Status
Network failures become *failure.NetworkError. Non-2xx responses become
*failure.APIError after a bounded transient body prefix is parsed for an
allowlisted code and request ID; the body is closed and not retained.
Retry-After accepts integer seconds. Successful invoke bodies are bounded by
MaxResponseBodyBytes; oversized successful bodies return
ResponseBodyTooLargeError.
Source and proof
Run go test ./transport ./failure.