Skip to main content

RouterBuildError

Enum RouterBuildError 

Source
pub enum RouterBuildError {
Show 14 variants InvalidSessionBackend(SessionBackendConfigError), InvalidIdempotencyBackend(String), InvalidSubmitTokenBackend(String), FrameworkRouteOverlap { path: String, existing: &'static str, incoming: &'static str, }, InvalidOpenApiPath { field: &'static str, value: String, }, DuplicateOpenApiPath { path: String, }, OpenApiPathCollision { field: &'static str, path: String, }, UnregisteredApiVersion { route_name: String, version: String, }, InvalidMcpPath { value: String, }, McpPathCollision { path: String, method: String, }, DuplicateUserRoute { method: String, path: String, existing: String, incoming: String, }, DuplicateNestPrefix { prefix: String, owners: String, }, ConflictingRouteShape { existing: String, existing_path: String, incoming: String, incoming_path: String, }, LocalePrefixPathCollision { locale: String, path: String, generated: String, },
}
Expand description

The refusal AppBuilder::plugin_route_infos and route_listing::collect_route_infos return.

Re-exported from the crate-private router module because both of those are public functions that hand it back: without this, a caller could not name the type, match its variants, or write the signature of a function that forwards it. Errors that can occur during the router build process.

These errors are typically fatal and represent configuration or routing definition issues that must be fixed before the application can start.

Variants§

§

InvalidSessionBackend(SessionBackendConfigError)

The session backend configuration is invalid (e.g. Redis without a URL).

§

InvalidIdempotencyBackend(String)

The idempotency backend configuration is invalid.

§

InvalidSubmitTokenBackend(String)

The submit-token backend configuration is invalid for production — an explicit [security.submit_token].backend = "memory" cannot safely deduplicate submits across replicas. Mirrors the idempotency production-memory fail-fast.

§

FrameworkRouteOverlap

A user-defined route conflicts with a framework-provided route.

Fields

§path: String

The HTTP path where the overlap occurred.

§existing: &'static str

The name of the existing framework route.

§incoming: &'static str

The name of the incoming user route.

§

InvalidOpenApiPath

An OpenApiConfig path (e.g. openapi_json_path or swagger_ui_path) is not a valid route path (must start with / and be non-empty).

Fields

§field: &'static str

Which config field carried the invalid path.

§value: String

The offending value from the user’s config.

§

DuplicateOpenApiPath

openapi_json_path and swagger_ui_path collide on the same URL. Mounting both would cause axum to panic on overlapping method routes at startup.

Fields

§path: String

The path that both fields pointed at.

§

OpenApiPathCollision

An OpenAPI mount path overlaps with an existing GET handler, which would panic at axum::Router::merge time.

Fields

§field: &'static str

Which config field carried the colliding path.

§path: String

The colliding path.

§

UnregisteredApiVersion

A route is annotated with an API version that is not registered.

Fields

§route_name: String
§version: String
§

InvalidMcpPath

The MCP mount path (from AppBuilder::mount_mcp) is not a valid route path. axum requires paths to start with /, so an invalid path is surfaced here rather than panicking at mount time.

Fields

§value: String

The offending mount path.

§

McpPathCollision

The MCP mount path collides with an existing application route at the same path. Mounting the MCP endpoint there would panic at axum::Router::merge time on overlapping method routes, so this is surfaced as a recoverable error instead.

Fields

§path: String

The colliding mount path.

§method: String

The HTTP method of the existing route at that path.

§

DuplicateUserRoute

Two user- or plugin-registered routes resolve to the same (method, path) after scope-prefix resolution. Mounting both would panic inside axum::routing::MethodRouter::merge at startup on overlapping method routes (issue #1012), so the collision preflight surfaces it as a recoverable RouterBuildError BEFORE any router is mounted and names both handlers so the offending call sites are obvious in the log.

Opaque routers registered via AppBuilder::merge or AppBuilder::nest are NOT introspectable through axum’s public API, so a collision that involves one of those routers cannot be detected up front and will still surface as an axum startup panic — the preflight emits a tracing::warn! in that case so operators know the check was skipped (mirrors the existing OpenAPI/MCP merge-router warnings).

Fields

§method: String

The HTTP method both handlers registered.

§path: String

The URL path both handlers registered (post scope-prefix resolution).

§existing: String

The route.name of the first (already-seen) handler.

§incoming: String

The route.name of the second (duplicate) handler that triggered the collision.

§

DuplicateNestPrefix

Two routers were registered at the SAME nest prefix via AppBuilder::nest.

Every nested router is given a fallback before it is mounted (mount_raw_routers), and axum cannot merge two method routers that both have one — nesting the second at a prefix the first already owns panics with “Cannot merge two MethodRouters that both have a fallback” while the router is built.

The declared-route preflight cannot catch this: two sandboxed plugins sharing a prefix while declaring disjoint routes have no route collision at all, and are accepted right up until the second nest panics. A prefix is therefore owned by whoever nests at it first.

Fields

§prefix: String

The prefix both routers were nested at.

§owners: String

Who claims the prefix, as far as the declared routes reveal.

§

ConflictingRouteShape

Two user- or plugin-registered routes normalize to the SAME Axum path shape but use DIFFERENT exact path templates — e.g. their capture names differ (/users/{id} vs /users/{slug}) or a normal capture meets a catch-all at the same position (/u/{id} vs /u/{*rest}).

axum’s matchit router rejects the second template as a route conflict before method-router merging, so — unlike an exact-duplicate path, which axum happily merges across distinct HTTP methods (DuplicateUserRoute) — these two templates can never coexist REGARDLESS of method. Issue #1012 surfaces the clash here (naming both handlers and both original templates) instead of letting the matchit conflict panic inside Router::route at startup.

Opaque AppBuilder::merge / AppBuilder::nest routers are exempt for the same reason as DuplicateUserRoute.

Fields

§existing: String

The route.name of the first (already-seen) handler.

§existing_path: String

The original path template registered by the first handler.

§incoming: String

The route.name of the second handler that triggered the conflict.

§incoming_path: String

The original path template registered by the second handler.

§

LocalePrefixPathCollision

Locale-prefix routing (issue #1251) would generate a path that collides with another route already registered at that exact path — e.g. an app defines both /foo and /en/foo while en is a supported locale: the bare-path redirect (mounted at every locale-prefix-eligible path, claiming every HTTP method) already owns /en/foo, so nesting /foo’s content under /en collides and axum panics on the overlapping route at router-construction time. Detected and surfaced as a build error instead (Codex review).

Fields

§locale: String

The supported locale whose nest produced the collision.

§path: String

The original, locale-prefix-eligible route path that got nested.

§generated: String

The resulting generated path (/{locale}{path}) that collides.

Trait Implementations§

Source§

impl Debug for RouterBuildError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RouterBuildError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RouterBuildError

Source§

impl Error for RouterBuildError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<SessionBackendConfigError> for RouterBuildError

Source§

fn from(source: SessionBackendConfigError) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for RouterBuildError

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RouterBuildError

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> AutumnCounterCaches for T
where T: 'static,

Source§

const HAS_COUNTER_CACHES: bool = false

Whether this model has any counter cache at all. Read more
Source§

fn counter_caches() -> &'static [CounterCacheSpec<Self>]

The model’s counter-cache specs, in declaration order.
Source§

impl<T> AutumnDependents for T
where T: ?Sized,

Source§

fn dependents() -> &'static [RuntimeDependentSpec]

The model’s dependent-cascade specs, in declaration order. Defaults to none; #[model] overrides via an inherent shadow when dependents exist.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, Conn> RunQueryDsl<Conn> for T

Source§

fn execute<'conn, 'query>( self, conn: &'conn mut Conn, ) -> <Conn as AsyncConnectionCore>::ExecuteFuture<'conn, 'query>
where Conn: AsyncConnectionCore + Send, Self: ExecuteDsl<Conn> + 'query,

Executes the given command, returning the number of rows affected. Read more
Source§

fn load<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a Vec with the returned rows. Read more
Source§

fn load_stream<'conn, 'query, U>( self, conn: &'conn mut Conn, ) -> Self::LoadFuture<'conn>
where Conn: AsyncConnectionCore, U: 'conn, Self: LoadQuery<'query, Conn, U> + 'query,

Executes the given query, returning a [Stream] with the returned rows. Read more
Source§

fn get_result<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, LoadNext<Pin<Box<Self::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, and returns the affected row. Read more
Source§

fn get_results<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<Self::LoadFuture<'conn>, TryCollect<Self::Stream<'conn>, Vec<U>>>
where U: Send, Conn: AsyncConnectionCore, Self: LoadQuery<'query, Conn, U> + 'query,

Runs the command, returning an Vec with the affected rows. Read more
Source§

fn first<'query, 'conn, U>( self, conn: &'conn mut Conn, ) -> AndThen<<Self::Output as LoadQuery<'query, Conn, U>>::LoadFuture<'conn>, LoadNext<Pin<Box<<Self::Output as LoadQuery<'query, Conn, U>>::Stream<'conn>>>>>
where U: Send + 'conn, Conn: AsyncConnectionCore, Self: LimitDsl, Self::Output: LoadQuery<'query, Conn, U> + Send + 'query,

Attempts to load a single record. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scoped for T
where T: Send + Sync + 'static,

Source§

fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>

Open a deferred ScopeQuery for this type. Resolves the registered scope at .load() time, not here.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ValidateIp for T
where T: ToString,

Source§

fn validate_ipv4(&self) -> bool

Validates whether the given string is an IP V4
Source§

fn validate_ipv6(&self) -> bool

Validates whether the given string is an IP V6
Source§

fn validate_ip(&self) -> bool

Validates whether the given string is an IP
Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more