Errors and diagnostics
Every error type the core returns, the wiring failures with their report text, and the compile-time diagnostics, by the phase that raises them.
A failure is raised at the earliest point that can see it. A type-local mistake is a compile error. A graph-wide mistake is a wiring error, found by wire() before any instance exists and before any I/O. A construction, readiness or hook failure is found by connect. A transport's configuration and sockets are found by listen. Everything else is a value returned from a call.
Three rules hold across the error types:
wire()collects. It runs every pass and returns every failure in oneWiringErrors. A missing binding does not hide an unrelated cycle. A step that depends on a missing piece skips only the affected edges.- Every public error type is
#[non_exhaustive]. A variant added to an enum breaks no caller that matches on it, and a field added to a struct breaks no caller that destructures it. - An error the core did not create itself, from user code, an integration or a transport, passes through one redaction function before a core error type stores it, and is stored as a
Redacted.DisplayandDebugwrite the redacted text andsource()isNone. The original is reached throughRedacted::downcast_refandinto_inner. The function replaces everySecretregistered with the graph and, as a backstop, strips the userinfo from anything shaped like a URL.
The core and the macros do not panic or exit. A panic in user code is caught at a poll boundary and reported as a value, unless the binary is built with panic = "abort".
Where each error arises
| Phase | Raised by | Error | Notes |
|---|---|---|---|
| compile | the macros, rustc | diagnostics, below and on Macros | |
wire() | AppBuilder::wire, TestApp::wire | StartupError::Wiring(WiringErrors) | every failure at once |
connect() | App<Wired>::connect | StartupError::Connect(ConnectError) | the first failure stops the walk |
listen() | App<Connected>::listen | StartupError::Configure(ConfigureErrors), then StartupError::Bind | prepare on every server before any bind |
| a call | get, execute, Resolver, ModuleRef | LookupError, Closed | |
| a call's pipeline | a transport's dispatch | GuardRejected, PanicRecovered, then the error handlers | |
load() | AppHandle::load | LoadError | |
close(), serve() | the shutdown sequence | ShutdownError holding ShutdownFailures | a failing step never stops the sequence |
StartupError
pub enum StartupError {
Wiring(WiringErrors),
Connect(ConnectError),
Configure(ConfigureErrors),
Bind { transport: TypeName, source: Redacted },
}Returned by wire, connect and listen. Bind is a transport's own error, or the core's RuntimeMissing. source.downcast_ref::<RuntimeMissing>() tells a misconfigured app from a port already taken. A bind that fails closes the transports already bound before it returns, so a refused app has no open sockets.
pub fn is_permanent(error: &StartupError) -> bool;Whether retrying this start, with this configuration on this runtime, cannot succeed. Wiring is always permanent. Connect, Configure and Bind are permanent when a Permanent marker is found under them, and Bind carrying RuntimeMissing is permanent too. An integration marks a failure with Err(Permanent::new(e).into()). A readiness attempt whose error is permanent ends the check at once, with no further attempt and no backoff. A timeout, a refused connection and a port already taken are retryable. main uses is_permanent to tell a start worth retrying from one that is not.
Wiring errors
wire() runs six passes and collects. The report is headed error: wiring failed with N errors, then one block per failure, each × headline followed by detail lines and a help: line. A type name prints short. Where one report would print two different types alike, a::Config and b::Config, both print with their full paths. A module that occurs more than once prints with #n: DbModule #2.
pub struct WiringErrors { /* .. */ }
impl WiringErrors {
pub fn iter(&self) -> std::slice::Iter<'_, WiringError>;
pub fn len(&self) -> usize;
pub fn is_empty(&self) -> bool;
}From examples/11-wiring-report, the report as a human reads it contains these lines:
wiring failed with 5 errors
duplicate binding for `u32` in TwiceModule
missing dependency `dyn Mailer`
needed by Notifier (field `_mailer`) in BrokenModule
ambiguous dependency `dyn Repo` in BrokenModule
exported by SqlModule
exported by MemoryModule
dependency cycle: Chicken → Egg → Chicken
scope violation: singleton `Directory` in BrokenModule depends on per-execution dataEach failure is also data. The example matches WiringError::DuplicateBinding { key, module, first, second } and reads first and second as Locations, one line apart.
Pass 1: module graph
| Variant | Headline | Cause and remedy |
|---|---|---|
ImportCycle { path } | M imports itself | a module lists an equal identity of itself under imports; remove the import, since a module sees its own bindings |
ReexportNotVisible { module, key, at } | re-export of `K` from M, which M cannot see | reexport of a key no import provides |
ReexportAmbiguous { module, key, sources, at } | ambiguous re-export of `K` in M | import the key from one module only |
KeyedInput { module, key, at } | execution input `K` declared in the keyed module M | inputs are app-wide and belong to transports |
NestedKeyed { module, outer, inner } | M is keyed twice, by `inner` and then by `outer` | key a module once, with the qualifier its importers read |
DuplicateSetting { setting, module, first, second } | the setting `s` is written twice in the settings of M | write each setting name once; a module appending its settings to an adapter's or an exporter's cannot reuse one of theirs |
DifferingSettings { module, first, second, settings } | two registrations of M differ in `name` | an equal identity is one module; write the same settings at both imports, or key one |
ExportNotBound { module, key, imported, near, at } | export of `K` from M, which M does not bind | bind it there, or reexport it when an import provides it |
DifferingSettings names both sites as ModuleSites (Root, Import { importer, at }, Load { at }) and each differing setting with both values after redaction. Modules that import one another, directly or through other modules, wire, because an import decides what a module sees and orders nothing. A cycle that blocks construction is a Cycle in pass 4. A module importing an identity equal to its own is reported as the ImportCycle alone, whatever settings that import carries.
Pass 2: bindings
| Variant | Headline | Cause and remedy |
|---|---|---|
DuplicateBinding { key, module, first, second } | duplicate binding for `K` in M | remove one, or give one a qualifier with .qualified::<Q>() |
KindMix { key, module, single, collection } | `K` is bound both as a single binding and as a collection in M | contribute every entry and read Many<T>, or bind it once |
DanglingAlias { alias, target, module, at } | alias `A` in M points at `T`, which M cannot see | bind the target or import a module that exports it |
ControllerProvided { key, controller, module, at, controller_at } | the controller `C` in M is registered as a provider, or is contributed to `K` for a collection | a controller registered as a provider (by provide, a factory, a value or a contribution), where its handlers never mount. at is the provider registration and controller_at the controllers registration of the same type, when the graph has one; the report names both. Remove the provider registration, or register the type with m.controller::<C>() |
ValueFailed { module, key, error, at } | the value for `K` in M failed to build: error | the Err a try_value recorded; error is redacted |
QualifiedRoleContribution { key, module, at } | a qualified contribution to the role key `R` in M is read by no transport | contribute it unqualified |
SingleRoleBinding { key, module, at } | a single binding under the role key `R` in M is read by no transport | contribute it: into R: [..] or m.contribute::<R>() |
DuplicateReadiness { key, module, first, second } | two readiness checks on `K` in M | fold both into one check |
InputConflict { key, first, second } | execution input `K` has two sources | an input is seeded by the one transport that declares it, and no module binds it |
UnreadPrefix { controller, module, prefix, transports, at } | the prefix `p` on `C` in M is read by none of its handlers | remove .at(..); a prefix reaches HTTP routes and WebSocket gateway paths |
InputConflict names each source as an InputOrigin: Transport { name, at }, Module { module, seeders, at } or Binding { module, at }. Two transports' declarations of one input with equal seeder sets, each written with also_seeded_by, merge into one and conflict with nothing. A role-key mistake in #[module] is refused earlier, at compile time, on the role key.
Test-only variants, from TestApp:
| Variant | Headline |
|---|---|
OverrideUnmatched { key, keyed, at } | override of `K` matches no binding |
OverrideAmbiguous { key, matches, at } | override of `K` matches several bindings |
OverrideModuleAmbiguous { module, candidates, at } | `.in_module::<M>()` matches several instances of M |
OverrideKind { key, expected, found, at } | override of `K` would change its kind: the binding is X, the override Y |
TimerOverride { at } | help: set it with `TestApp::timer(..)` |
RuntimeOverride { at } | help: set it with `TestApp::runtime(..)` |
ReplacementMissingExports { original, replacement, missing } | R replaces O without exporting every key O exports |
ReplacementUnmatched { original, at } | `replace_module` replaces O, which no module imports |
DuplicateReplacement { original, first, second } | two `replace_module` calls replace O; wiring applied only the first |
Pass 3: visibility
| Variant | Headline | Cause and remedy |
|---|---|---|
Missing { key, consumer, module, near } | missing dependency `K` with needed by C (field f) in M | import a module that exports it, or provide it in the module |
Ambiguous { key, consumer, module, sources } | ambiguous dependency `K` in M | one exported by X (file:line) line per source |
ControllerRead { controller, consumer, module, controller_module } | the controller `C` in M is read by X in N | a controller is the edge of the application, reached by its transport alone; move the shared logic into a provider both can read |
Missing carries near when the key differs from a bound key only by a trailing + Send + Sync: dyn Repo and dyn Repo + Send + Sync are distinct TypeIds, and this is the one place the mismatch is visible. The help line then reads M exports dyn Repo + Send + Sync; the injection point reads dyn Repo``. ControllerRead covers a construction, an optional read, a hook, a readiness check, an alias, a module hook and an enhancer closure. A controller reading a controller, a handler parameter and a runtime app.get::<Ctl>() are not checked.
Pass 4: cycles
| Variant | Headline |
|---|---|
Cycle { path } | dependency cycle: A → B → A, followed by one `K` in M line per step |
Pass 5: scopes
| Variant | Headline | Cause and remedy |
|---|---|---|
ScopeViolation { binding, declared, by_closure, controller, module, path } | scope violation: singleton `S` in M depends on per-execution data | declare the type #[injectable(execution)], or inject a factory. For a controller (controller is true) the help leads with removing singleton, since an Auto controller is built per call when it needs to be, and adds that #[controller(execution)] builds it per call whatever it reads. An Auto provider reads scope violation: `S` in M is a provider, so a singleton, and depends on per-execution data. The hint names #[injectable(execution)] for a type, #[controller(execution)] for a controller and with(execution) or .execution(..) for a closure. |
HooksOnPerExecution { binding, module } | lifecycle hooks on `S` in M, which the scope pass inferred per-execution | hooks run on singletons only; a closure hook or .ready(..) counts as a hook |
ClosureScopeViolation { closure, transport, role, path, at } | scope violation: <closure> (Http), declared by closure as a singleton, depends on per-execution data | an enhancer a handler declares as an explicit singleton closure; drop the scope or write with(execution) |
ClosureNeedsExecution { closure, path, at } | <closure> reads per-execution data | a hook, readiness, module-hook or metadata closure runs where no execution exists; read singletons there, or take ModuleRef and open an execution with execute |
InputNotSeeded { handler, transport, input, seeder, steps } | input `K` is seeded by Http, read on a path from the Rpc handler C::h | read it as Option<Dep<K>> where the path is shared across transports |
ScopeViolation prints the dependency path that introduces the execution dependency, each step as it reads, for instance Directory → Session (execution).
Pass 6: environment
| Variant | Headline | Cause and remedy |
|---|---|---|
BoundWithoutTimer { item, at } | <item> needs a Timer, and the app has none | set one with .timer(..), or leave the bound at its default or write .unbounded() |
BackoffWithoutTimer { binding, at } | readiness `.backoff` of `B` waits between attempts on a `Timer`, and the app has none | set a timer, or remove .backoff(..) |
KnobWithoutTimer { knob } | `knob` is set on an app with no `Timer` | every timing knob is timed by the Timer |
ZeroBound { item, binding, module, at } | a zero bound on the <item> of <owner> would end it before it starts | write .unbounded() or give it a duration above zero |
ZeroDefault { knob, at } | `construct_timeout` is zero, which would end every item left at its default before it starts | write .unbounded() on the items, or give the knob a duration above zero |
ZeroBound's item is a BoundItem: Construction, ReadinessWhole, ReadinessAttempt or Hook(HookKind). Each report points at the call that wrote the wait; a trait const's After(..) names the registration that brought the type in.
Connect, load and shutdown
pub enum ConnectError {
Construct { key: KeyName, module: ModuleName, reason: FailureReason },
Readiness { key: KeyName, module: ModuleName, attempts: u32, reason: FailureReason },
Hook { hook: HookKind, key: KeyName, reason: FailureReason },
}
pub enum FailureReason {
Panicked(Redacted),
TimedOut { after: Duration, limit: Limit },
Skipped,
Errored(Redacted),
}
pub enum Limit {
Item,
Attempt,
Default,
ShutdownCap,
}One FailureReason serves every place a hook, a construction, a readiness check or a transport's close can fail, so a timeout reads the same on all of them. Skipped is reachable at shutdown on Hook alone. FailureReason implements Display and Debug, not Error.
Limit | Meaning |
|---|---|
Item | an explicit bound on the whole item: a trait const's After(..), or .timeout(..) on a binding handle |
Attempt | an explicit .attempt_timeout(..) on a readiness check |
Default | the app default for the item's kind: hook_timeout, or construct_timeout |
ShutdownCap | shutdown_timeout cutting a hook or a close mid-run |
Display texts: failed to construct K in M: reason; readiness check of K in M failed after N attempts: reason; `OnModuleInit` hook of `K` failed: reason. A reason prints as panicked: message, timed out after 10s (its own bound), or skipped: shutdown_timeout had expired.
A bound the Timer refuses (a runtime that has shut down) is Errored holding a Permanent RuntimeShutDown, at every site. The first failure during connect stops the walk and drops the app: singletons already built run no destroy hook, and their resources release as the instances drop. What an init hook did outside the process, such as a registration with service discovery, is not undone.
A readiness check that does not pass reports the last attempt's reason, or the whole-check TimedOut { limit: Item }. A check that ran out of retries on errors reports Errored holding the last attempt's error.
pub enum LoadError {
Closed(Closed),
Wiring(WiringErrors),
Connect(ConnectError),
Refused(LoadRefusal),
}
pub enum LoadRefusal {
Controllers { module: ModuleName },
Middleware { module: ModuleName },
Contribution { module: ModuleName, key: KeyName },
GlobalExport { module: ModuleName, key: KeyName },
Input { module: ModuleName, key: KeyName },
}AppHandle::load wires a module against the frozen graph, so its wiring errors are the ones above, and connects it through its own readiness checks and hooks. LoadRefusal names what the frozen graph cannot take: controllers (cannot load M: it declares controllers, and routes are already bound), module metadata such as middleware, contributions to a collection the module does not introduce, global exports, and execution inputs. Loading the same identity twice returns the existing handle when the settings are equal, and LoadError::Wiring holding DifferingSettings when they differ. A failed load restores the base graph and removes the singletons it built.
pub struct Shutdown {
pub signal: Signal,
pub abandoned: usize,
pub terminal_skipped: usize,
}
pub struct ShutdownError {
pub report: Shutdown,
pub failures: Arc<[ShutdownFailure]>,
}
pub enum ShutdownFailure {
Hook { hook: HookKind, key: KeyName, reason: FailureReason },
Close { transport: TypeName, reason: FailureReason },
Dropped,
Serve { transport: TypeName, end: ServeEnd },
}
pub enum ServeEnd {
Errored(Redacted),
Panicked(Redacted),
Returned,
}serve and close return Result<Shutdown, ShutdownError>. abandoned counts executions still alive at the drain's end; terminal_skipped counts the terminal executions, a connection's cleanup, refused or abandoned. ShutdownError is Clone with its contents behind an Arc because one outcome has several receivers: serve and every close caller. A transport whose serve ends while the app runs starts the shutdown, and its failure is listed first as ShutdownFailure::Serve under the signal transport `name` failed: reason or transport `name` stopped serving. Dropped is what a close on a kept handle answers once a drop has released the servers before the close step ended; it runs no step.
Startup configuration
pub struct ConfigureErrors { /* .. */ }
pub struct ConfigureError { pub transport: TypeName, pub source: Redacted }
pub struct RuntimeMissing { pub transport: TypeName }
pub struct PreparePanicked { pub message: Redacted }
pub struct PrepareError { /* .. */ }listen() calls prepare on every queued server and collects every failure into one ConfigureErrors before any server binds, so a configuration error is always reported before a port conflict. A server whose failure names types answers a PrepareError, whose text the report writes with full paths where two names collide. A PrepareError lists PrepareEntry values, each naming the types involved, the line that declared the item and the route scopes concerned. A refusal of something that would never run carries an Unreached reason, read with PrepareEntry::reason: NoRoute, HealthOnly { service }, EmptyScope, RawGateway or BackslashSegment. A prepare that panics is caught and becomes that server's entry, with a PreparePanicked as its source (`prepare` panicked: message). The other servers still prepare and nothing binds.
RuntimeMissing prints transport `T` is bound on an app with no `Runtime`; set one with `.runtime(..)`, which sets the app's timer too. A .timer(..) alone does not satisfy it.
Lookup, execution and construction
pub enum LookupError {
NotFound { key: KeyName, kind: LookupKind },
NotReady { key: KeyName },
WrongType { key: KeyName, requested: &'static str },
WrongKind { key: KeyName, expected: BindingKind, found: BindingKind },
ExecutionRequired { key: KeyName },
ExecutionEnded { key: KeyName },
Ambiguous { key: KeyName, sources: Vec<ModuleName> },
AmbiguousModule { module: &'static str, candidates: Vec<ModuleName> },
Construct { key: KeyName, reason: FailureReason },
Closed { key: KeyName },
}
pub enum LookupKind {
Binding,
Extension,
Input,
Module,
}| Variant | Display | When |
|---|---|---|
NotFound | no binding for `K` is visible from this module, the extension `K` was not written in this execution, the execution input `K` was not seeded in this execution, no module `K` is registered | a key nothing binds, an extension no guard wrote, an input a standalone execution did not seed, a module of that type; Option<S> turns this and only this into None |
NotReady | `K` is a singleton the connect walk has not built yet | ModuleRef::get during connect |
WrongType | `K` does not hold a `T` | Resolver::by_key asked for a T the key does not hold |
WrongKind | `K` is X, read as Y | a single binding read as a collection, or the reverse |
ExecutionRequired | `K` needs an execution, and none is open here | reading per-execution data outside an execution |
ExecutionEnded | `K` was read through an execution that has ended | get on an ExecutionRef kept past the execution's end |
Ambiguous | `K` is ambiguous between .. | a runtime lookup of a key two visible exports answer |
AmbiguousModule | `M` is ambiguous between .. | module::<M>() over several configurations of M; name one with module_keyed or module_of |
Construct | building `K` inside the call failed: reason | an execution-scoped or transient build that failed, panicked or timed out |
Closed | `K` is a singleton, and the application has begun destroying its singletons | a singleton lookup from the first destroy hook on |
pub enum ConstructError {
Dependency(LookupError),
Failed(BoxError),
}
impl ConstructError {
pub fn failed(e: impl Into<BoxError>) -> Self;
}What Construct::construct fails with. Dependency is a dependency read that failed. The core passes it through unchanged, so the caller sees the dependency's own error naming the deeper key. Failed is the constructor's own error, reported as Construct { reason: Errored(..) }. From<LookupError> is implemented and no blanket From<E: Error> is, so ? on a dependency read works as written and the constructor's own error goes through ConstructError::failed. A hand-written Construct that reads a key, an extension or the execution that its dependencies does not declare fails at its first construction with a Permanent UndeclaredRead naming the key and the reading type.
pub struct Closed;execute and Execution::open answer Closed from the Draining phase on: the application is shutting down. Execution::open_terminal with a DrainToken is allowed in Draining, for a connection's cleanup.
Errors in a call
pub struct GuardRejected { pub guard: &'static str }
pub struct PanicRecovered { pub stage: DispatchStage, pub message: Redacted }
pub enum DispatchStage {
Guard,
Interceptor,
Handler,
ErrorHandler,
PreDispatch,
}
pub struct EndStream;
pub fn is_panic(error: &BoxError) -> bool;A guard's Ok(false) reaches the error handlers as GuardRejected (guard `G` refused the call). A panic in a guard, an interceptor, a handler or an error handler is caught at its stage and travels as PanicRecovered (the handler panicked: message) through the interceptors around the handler and then to the error handlers. Unclaimed, a transport renders its own internal-error status. A panic while the container builds an enhancer or the controller inside a call is LookupError::Construct { reason: Panicked(..) }.
is_panic is true wherever a core error carries a caught panic: a PanicRecovered, a LookupError::Construct with Panicked, a PreparePanicked, a ConnectError whose reason is Panicked, bare or inside LoadError or StartupError. It follows a wrapper's chain to 32 levels. It takes &BoxError, which is what an error handler has. Against a &dyn Error it is E0277, and a caller with a bare &dyn Error writes &*err.
EndStream is the sentinel an error handler returns on the late path, after a stream has started, to end the stream cleanly as if it had returned None. An Ok from a handler on the late path is ignored and logged: it was written for the pre-stream case, and ending cleanly on it would tell the client the stream completed when it failed.
The transport layer adds the call-level types. CallError is the one concrete error every transport renders, with a kind, a public message, typed details and the domain error as its source. Classify maps a domain error to an ErrorKind, and #[derive(Classify)] writes it. ExtractError is the flat failure of a handler parameter:
pub enum ErrorKind {
BadRequest,
Unauthorized,
Forbidden,
NotFound,
Conflict,
Unprocessable,
TooManyRequests,
Timeout,
Unavailable,
Unimplemented,
Internal,
}
pub enum ExtractError {
Missing { param: &'static str },
Malformed { param: &'static str, source: Redacted },
Mismatched { param: &'static str, source: Redacted },
UnsupportedMediaType { param: &'static str, expected: &'static str },
TooLarge { param: &'static str, limit: u64 },
Invalid { param: &'static str, violations: Vec<FieldViolation> },
Dependency { param: &'static str, source: LookupError },
HostMissing { param: &'static str, type_name: &'static str },
BodyTaken { param: &'static str, extractor: &'static str },
Overflowed { param: &'static str, limit: u64 },
OverflowedBytes { param: &'static str, limit: u64 },
}ErrorKind::as_str gives the WebSocket and RPC envelope's kind: bad_request, not_found and so on. An ExtractError implements Classify: BadRequest for most, Unprocessable for Invalid and Mismatched, Unavailable for Overflowed and OverflowedBytes, and Internal with the message withheld for HostMissing and BodyTaken, which are deployment faults. TooLarge is a bound on one body or item: an HTTP body, a gRPC message, or an RPC streamed request's item over the link's max_queued_bytes on its own, which classifies as BadRequest. Overflowed and OverflowedBytes are a streamed request's items arriving faster than the handler reads them, past the count bound or the byte bound, and end the stream. Dependency carries the LookupError of a container-read parameter that failed. PreDispatch is a panic in a transport's pre-dispatch stage, a middleware or a tower layer. An error handler reshapes one with err.downcast_ref::<CallError>()?.source_as::<ExtractError>(). HTTP adds the statuses 413 and 415 from TooLarge and UnsupportedMediaType.
Compile-time diagnostics
The macros raise syn::Errors spanned on the offending token and emit one assertion per field and parameter, so a diagnostic points at the field, the parameter or the attribute argument and not at the macro invocation. The text of each is on Macros and Handler attributes. The rest come from trait bounds that carry #[diagnostic::on_unimplemented] messages written as instructions.
| Mistake | Mechanism | Message |
|---|---|---|
| a field or parameter that is not an injection point | FromContainer bound | `String` cannot be obtained from the container; write Dep<String> |
a provider that is not Construct | Construct bound | `X` is not a type the container can construct; add #[injectable] or bind it with a factory |
Ext or ExecutionRef in a singleton | AllowedIn<S> | a `Singleton` type cannot read `Ext<T>` |
| a hook on an execution-scoped or transient type | Construct<Scope: HookCapable> | lifecycle hooks are only allowed on singletons |
| an enhancer that lacks its role trait | Guard<T> and kin | `X` is not a guard for `Rpc`; implement Guard<Rpc> |
enhancer::<K>() with a K that is not a role key | Role bound | `dyn Plugin` is not a role key; the role keys are AnyGuard<T>, AnyInterceptor<T> and AnyErrorHandler<T> |
.qualified::<Q>() on an enhancer contribution | Contribute<.., Enhancer> has no qualified | E0599: no method named qualified found for struct Contribute<..> |
a closure hook or .ready(..) on an execution-scoped or transient handle | typed binding handle | E0599: the method on_init or ready exists for struct Handle<..>, but its trait bounds were not satisfied |
| a second bound on one binding-handle item | typed binding handle | E0599: the method timeout or unbounded exists for struct Handle<..>, but its trait bounds were not satisfied |
| a key written as a string | Key is built from types | E0061: this method takes 0 arguments but 1 argument was supplied |
#[handlers] on a type that is not a #[controller] | Controller bound on Handlers | `X` is not a controller; write #[controller] on X |
a #[controller] type with no #[handlers] impl, or an #[injectable] type under controllers | Handlers bound | `X` is not a controller with handlers; a controller is declared with #[controller], and its handlers with #[handlers] |
a controller listed under providers | ControllerNotAProvider bound | `X` is a controller, listed under `providers`; a controller goes under controllers |
Dep<T> with T not Send + Sync | auto-trait bounds | rustc's own message, with no Ulo note |
a constructor that is not Send | generated impl | future cannot be sent between threads safely |
into over a Meta type | contribution-key bound | `PreDispatch` is module metadata, not a contribution key |
#[meta] naming another transport | TransportMetadata probe | E0308: expected (), found MetaMismatch<Rpc, Http> |
The Send + Sync case has no Ulo note because rustc reports the unsatisfied auto trait from the bound's where-clause and drops any wrapper trait's note. The fix, Send + Sync as supertraits of the trait, is documented here and not diagnosed.
The snapshot of each diagnostic is crates/ulo-codegen-tests/tests/ui/*.stderr, compared in CI. Wording that rustc itself writes follows the toolchain version. The ulo-written lines are stable.
What is refused, and when
| Refusal | When |
|---|---|
an unsatisfiable injection point, an unsatisfied role bound, a controller declared without #[controller] or #[handlers], a hook on a non-singleton, a bad attribute argument, a handler that reads the body twice | compile |
| a missing, ambiguous or duplicate binding, a cycle, an export of an unbound key | wire() |
a singleton reading execution data, a hook on a type inferred per-execution, a hook or readiness closure reading Ext | wire() |
| an input read on a path from a transport that does not seed it | wire() |
a written wait with no Timer, a zero bound, a zero default | wire() |
| a keyed module keyed again, a second import with other settings, a setting name written twice | wire(), or load() |
| a module importing itself | wire() |
| a controller registered as a provider | wire() |
| a stale override, an ambiguous override, a stale module replacement | wire(), in a test |
a controller .at(prefix) that no handler reads | wire() |
a hand-written Construct reading what it did not declare | first construction |
| a constructor, factory, readiness check or hook that fails, panics or times out | connect() |
a transport bound with no Runtime | listen() |
a server's prepare failing or panicking | listen(), before any bind |
| a lazy module that brings controllers, middleware, global exports, inputs, or contributions to a foreign collection | load() |
execute or Execution::open from Draining on | Closed |
| a singleton lookup from the first destroy hook on | LookupError::Closed |
| a guard's refusal, a panic in the pipeline | the error handlers, as GuardRejected and PanicRecovered |
a shutdown hook that panics, times out or is skipped; a close that fails or exceeds its bound | ShutdownError |