DioxusLabs/dioxus · error
`Link` must have access to a parent router
Error message
`Link` must have access to a parent router
What it means
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.
Source
Thrown at packages/router/src/components/link.rs:161
attributes,
new_tab,
onclick,
onclick_only,
rel,
to,
class,
..
} = props;
// hook up to router
let router = match use_router_internal() {
Some(r) => r,
#[allow(unreachable_code)]
None => {
let msg = "`Link` must have access to a parent router";
error!("{msg}, will be inactive");
#[cfg(debug_assertions)]
panic!("{}", msg);
return VNode::empty();
}
};
let current_url = router.full_route_string();
let href = match &to {
NavigationTarget::Internal(url) => url.clone(),
NavigationTarget::External(route) => route.clone(),
};
// Add the history's prefix to internal hrefs for use in the rsx
let full_href = match &to {
NavigationTarget::Internal(url) => router.prefix().unwrap_or_default() + url,
NavigationTarget::External(route) => route.clone(),
};
let mut class_ = String::new();
if let Some(c) = class {
class_.push_str(&c);View on GitHub (pinned to 24f6a829df)
Solutions
- Render Link inside a Router component so it can access the router context.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at packages/router/src/components/link.rs:161 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/a63f6e2cfb62a51f.
Report an issue: GitHub.