Streaming request body errors are always reported as `internal`
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
- Domain
- backend-api-design
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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from connectrpc/connect-rust
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
connectrpc/connect-rust#360 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
connectrpc/connect-rust#358 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 53/100
connectrpc/connect-rust#355 ·
-
Difficulty 3/5 Half a day Newbie friendliness 48/100
connectrpc/connect-rust#349 ·
-
Client fails 12 cases of connectconformance v1.0.7 (gRPC-Web bidi metadata, gRPC truncated server-stream message)Possibly taken @excavador claimed this 34 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
connectrpc/connect-rust#346 · 1 comment ·
All issues in connectrpc/connect-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Choochmeque/tauri-plugin-webdriver#134 ·
Maintainers usually reply within 17 days
-
bug rust SDK & CLI & REST API
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
boxlite-ai/boxlite#3292 ·
Maintainers usually reply within 1 day
-
Android bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anefzaoui/misterdownloadmanager#2516 ·
Maintainers usually reply within 1 day
-
editor ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
state:triage tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 89/100
agent8-cash/ethpayserver#731 ·
Maintainers usually reply within 1 day