{"record":{"id":"29c178ccd303622c","repo":"DioxusLabs/dioxus","slug":"failed-to-create-new-router-after-hot-patch","errorCode":null,"errorMessage":"Failed to create new router after hot-patch!","messagePattern":"Failed to create new router after hot-patch!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/fullstack-server/src/launch.rs","lineNumber":237,"sourceCode":"\n            // Handle just hot-patches for now.\n            // We don't do RSX hot-reload since usually the client handles that once the page is loaded.\n            //\n            // todo(jon): I *believe* SSR is resilient to RSX changes, but we should verify that...\n            Either::Right(DevserverMsg::HotReload(HotReloadMsg {\n                jump_table: Some(table),\n                for_build_id,\n                ..\n            })) if for_build_id == our_build_id => {\n                // Apply the hot-reload patch to the dioxus devtools first\n                unsafe { dioxus_devtools::subsecond::apply_patch(table).unwrap() };\n\n                // Now recreate the router\n                // We panic here because we don't want their app to continue in a maybe-corrupted state\n                make_service = hot_serve_callback\n                    .call(())\n                    .await\n                    .expect(\"Failed to create new router after hot-patch!\")\n                    .into_make_service();\n\n                // Make sure to wipe out the renderer state so we don't have stale elements\n                crate::document::reset_renderer();\n\n                _ = shutdown_tx.send(());\n            }\n\n            // Explicitly don't handle RSX hot-reloads on the server\n            // The client will handle that once the page is loaded. If we handled it here,\n            _ => {}\n        }\n    }\n}\n\nfn block_on<T>(app_future: impl Future<Output = T>) {\n    if let Ok(handle) = tokio::runtime::Handle::try_current() {\n        handle.block_on(app_future);","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/fullstack-server/src/launch.rs#L219-L255","documentation":"When the fullstack dev server receives a subsecond (hot-patch) build matching its build id, it applies the patch and rebuilds the application router through the hot_serve_callback from the launch config. If that callback returns Err, the server panics by design: it refuses to continue serving after a half-applied patch that could leave the app corrupted.","triggerScenarios":"Running dx serve on a fullstack app with hot-patching enabled; the callback that reconstructs the axum router returns Err — server function registration failures, router construction errors, or an incompatible subsecond patch applied to server code.","commonSituations":"Version skew between dioxus-cli (dx), dioxus-fullstack and subsecond crates; editing server-side code (server functions, router setup) in ways subsecond cannot cleanly patch; sockets/resources in a bad state after rapid successive edits.","solutions":["Read the error printed with the panic — it is the real error from your serve callback; fix that root cause","Restart dx serve for a full rebuild to escape the half-patched state","Align toolchain: upgrade dioxus-cli and the dioxus workspace crates to the same release together","If it persists, disable hot-patching (use full-reload dev mode) or cargo clean and rebuild"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep dioxus-cli (dx) and dioxus crates upgraded together to matching releases","Treat subsecond hot-patch failures as recoverable by full restart: don't leave dx serve running after this panic","Prefer full-reload dev mode when editing server code heavily","Report recurring failures with the underlying callback error text to dioxus"],"tags":["fullstack","hot-reload","dev-server","cli","subsecond","panic"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}