Streaming request body errors are always reported as `internal`

Open
#352 0 comments 0 reactions 0 assignees View on GitHub

@AhmedElBanna80 is already working on this.

Since Nov 15, 2026.

  • #353 by @AhmedElBanna80 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start in connectrpc/src/service.rs tests and trace decode_request_body through the streaming body read path; compare its error handling with collect_body_limited. Reproduce the Limited body case and a body error containing a ConnectError, then check that the stream reports resource_exhausted or forwards the Connect error while unrelated errors remain internal. Keep the public API unchanged.

Written by the indexing model from the issue text.

Description

The server reports every failure of a streaming request body as internal, whatever the error is. The unary path does not: collect_body_limited maps http_body_util::LengthLimitError to resource_exhausted.

This matters to a server that bounds a client- or bidi-streaming request in total, for example by wrapping the body in http_body_util::Limited, or with a body whose error is (or wraps) a ConnectError. The handler's request stream ends with internal: failed to read request body: ..., and the client cannot tell "too large" or "shedding load" from a broken transport.

Related but different: #321 (size-limit errors the client sees) and #150 (introduced surfacing body errors to handlers).

Repro (in connectrpc/src/service.rs tests, using decode_request_body):

// Limited's error is Box<dyn Error>, which is not an Error, so adapt it with
// a newtype that keeps the source.
let body = BodyExt::map_err(Limited::new(Full::new(two_messages), 12), Boxed);
let mut stream = decode_request_body(body, DEFAULT_MAX_MESSAGE_SIZE, None, registry);
let err = stream.next().await.unwrap().unwrap_err();
assert_eq!(err.code, ErrorCode::ResourceExhausted); // actual: Internal

The same happens when a body fails with a ConnectError (for example unavailable): the handler sees internal.

Proposed fix (PR to follow): the streaming internals only require B::Error: Display + Send today, while the public Service impl already requires std::error::Error + Send + Sync + 'static. Take the same bound internally, then on a body-read failure walk the error's source chain: a ConnectError is forwarded as it is, a LengthLimitError becomes resource_exhausted (matching the unary path), and anything else stays internal. No public API change.

Dominant language
Rust
Stars
544
Forks
77
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from connectrpc/connect-rust

All issues in connectrpc/connect-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.