Optional: make ConnectError's non-exhaustiveness explicit (original semver premise was wrong)
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 48/100
Research direction
Start in connectrpc/src/error.rs and inspect ConnectError's existing private and pub(crate) fields, along with any in-crate struct literals. Decide whether adding #[non_exhaustive] provides useful explicit API hygiene; done is either adding the attribute without breaking in-crate construction or confirming that no change is needed.
Written by the indexing model from the issue text.
Description
Correction (2026-07-24): the premise below is wrong.
ConnectErroralready has three non-public fields —http_status_override(private) plusresponse_headersandtrailers(pub(crate)) — which appear after the three public ones in the struct definition. A struct with any non-pubfield already cannot be built with a struct literal, nor exhaustively destructured, from outside the defining crate. So adding a field toConnectErroris not a breaking change today, and#[non_exhaustive]would be a no-op for downstream compilation.I filed this after reading a truncated view of the struct that stopped just above the private fields. Apologies for the noise.
What remains, at much lower value: the attribute would make the existing guarantee explicit and machine-checked, rather than an emergent consequence of three fields happening to be non-public. If someone later made those fields public — for instance while addressing the reads that
response_headers()/trailers()accessors currently serve — the semver protection would vanish silently.Limitscarries the attribute for the same reason.Keeping this open as optional hygiene, not as release-blocking work, and explicitly not as a reason to rush anything into the 0.9.0 window. Closing it as "not needed" is a perfectly good outcome.
Original report (superseded by the correction above)
ConnectError has public fields and no #[non_exhaustive], so adding any field to it is a breaking change for downstream crates.
// connectrpc/src/error.rs
/// A ConnectRPC error.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConnectError {
/// The error code.
pub code: ErrorCode,
/// Human-readable error message.
pub message: Option<String>,
/// Additional error details.
pub details: Vec<ErrorDetail>,
}
Any consumer that writes ConnectError { code, message, details } as a struct literal, or destructures it exhaustively in a match, fails to compile the moment a field is added.
Why now
This is the type most likely to grow. #240 adds a source field to it, and #237 proposes carrying the transport error's source chain — both are field additions to this struct. Without the attribute each one is a semver break, which is a poor trade for what is otherwise additive behaviour.
Limits already carries #[non_exhaustive] for exactly this reason, so the crate is internally inconsistent as well.
Proposal
Add #[non_exhaustive] to ConnectError in 0.9.0, while the breaking-change window for the release is open.
The cost to downstream users is that struct-literal construction and exhaustive destructuring stop working; both are already discouraged for this type, which has constructors for every code (ConnectError::internal, ::unavailable, and so on) plus ConnectError::new. Field reads are unaffected, which is how the type is used in practice.
Worth deciding alongside it: whether the fields should stay pub at all. ClientConfig uses private fields with with_/accessor pairs and is the better-shaped example, but making these private is a larger break and can wait — #[non_exhaustive] alone captures the future-proofing that matters.
Notes
Cheap to do (one attribute plus any in-crate struct literals), and it stops being cheap the moment 0.9.0 ships.
- 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 ·
-
Streaming request body errors are always reported as `internal`Possibly taken @AhmedElBanna80 claimed this 18 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 72/100
connectrpc/connect-rust#352 ·
-
Difficulty 3/5 Half a day Newbie friendliness 48/100
connectrpc/connect-rust#349 ·
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