DioxusLabs/dioxus · error

Failed to create new router after hot-patch!

Error message

Failed to create new router after hot-patch!

What it means

After applying a Subsecond hot-patch on the dev server, constructing the replacement axum Router failed. The patched code no longer satisfies the router's type/invariant expectations, so the server cannot rebuild its handler.

Solutions

  1. Check the hot-patch output for errors; the server failed to rebuild its router after a hot patch, so verify the patched code still compiles and registers routes correctly.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/fullstack-server/src/launch.rs:237 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/29c178ccd303622c. Report an issue: GitHub.

Appendix: source

Thrown at packages/fullstack-server/src/launch.rs:237

            // Handle just hot-patches for now.
            // We don't do RSX hot-reload since usually the client handles that once the page is loaded.
            //
            // todo(jon): I *believe* SSR is resilient to RSX changes, but we should verify that...
            Either::Right(DevserverMsg::HotReload(HotReloadMsg {
                jump_table: Some(table),
                for_build_id,
                ..
            })) if for_build_id == our_build_id => {
                // Apply the hot-reload patch to the dioxus devtools first
                unsafe { dioxus_devtools::subsecond::apply_patch(table).unwrap() };

                // Now recreate the router
                // We panic here because we don't want their app to continue in a maybe-corrupted state
                make_service = hot_serve_callback
                    .call(())
                    .await
                    .expect("Failed to create new router after hot-patch!")
                    .into_make_service();

                // Make sure to wipe out the renderer state so we don't have stale elements
                crate::document::reset_renderer();

                _ = shutdown_tx.send(());
            }

            // Explicitly don't handle RSX hot-reloads on the server
            // The client will handle that once the page is loaded. If we handled it here,
            _ => {}
        }
    }
}

fn block_on<T>(app_future: impl Future<Output = T>) {
    if let Ok(handle) = tokio::runtime::Handle::try_current() {
        handle.block_on(app_future);

View on GitHub (pinned to 24f6a829df)