{"record":{"id":"a63f6e2cfb62a51f","repo":"DioxusLabs/dioxus","slug":"link-must-have-access-to-a-parent-router","errorCode":null,"errorMessage":"`Link` must have access to a parent router","messagePattern":"`Link` must have access to a parent router","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/router/src/components/link.rs","lineNumber":161,"sourceCode":"        attributes,\n        new_tab,\n        onclick,\n        onclick_only,\n        rel,\n        to,\n        class,\n        ..\n    } = props;\n\n    // hook up to router\n    let router = match use_router_internal() {\n        Some(r) => r,\n        #[allow(unreachable_code)]\n        None => {\n            let msg = \"`Link` must have access to a parent router\";\n            error!(\"{msg}, will be inactive\");\n            #[cfg(debug_assertions)]\n            panic!(\"{}\", msg);\n            return VNode::empty();\n        }\n    };\n\n    let current_url = router.full_route_string();\n    let href = match &to {\n        NavigationTarget::Internal(url) => url.clone(),\n        NavigationTarget::External(route) => route.clone(),\n    };\n    // Add the history's prefix to internal hrefs for use in the rsx\n    let full_href = match &to {\n        NavigationTarget::Internal(url) => router.prefix().unwrap_or_default() + url,\n        NavigationTarget::External(route) => route.clone(),\n    };\n\n    let mut class_ = String::new();\n    if let Some(c) = class {\n        class_.push_str(&c);","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/router/src/components/link.rs#L143-L179","documentation":"Link called use_router_internal() and got None, so no ancestor Router provides navigation context. A Link must live inside a Router; in debug builds this is a hard panic while release renders an empty node after logging.","triggerScenarios":"Thrown at packages/router/src/components/link.rs:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Render Link inside a Router component so it can access the router context."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}