LukeMathWalker / LukeMathWalker/pavex
Mislabeled exception when unable to resolve dependency graph
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 80
- PR merge metrics
- No merged PRs in 30d
Description
I was very confused when I got this error pointing to the default route that comes with the template.
ERROR:
x I don't know how to handle the type returned by `app::routes::system::health_check`.
|
| ,-[app/src/routes/mod.rs:10:1]
| 10 | pub fn handler(bp: &mut Blueprint) {
| 11 | bp.route(GET, "/healthz", f!(crate::routes::system::health_check));
| : ^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^
| : `-- The request handler was registered here
| 12 | }
| `----
| ,-[app/src/routes/system.rs:4:1]
| 4 | #[must_use]
| 5 | pub const fn health_check() -> StatusCode {
| : ^^^^^|^^^^
| : `-- The output type that I can't handle
| 6 | StatusCode::OK
| `----
Turns out, the error triggers when you try to import a crate which uses a different version of a dependency your app crate also requires. I've created an example repo with two commits. The first one does not compile with the above error, while mirroring the features on the app crate compiles without issues.
Contributor 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.
Research direction
Start with the linked pavex_statuscode_repro repository and compare its two commits, focusing on the dependency versions mirrored in the app crate. Then trace the dependency-graph resolution and diagnostic path that produces the handler return-type error. Done means the version conflict is reported accurately instead of being attributed to health_check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100