DioxusLabs/dioxus · error

index route does not exist: {} use LiveviewHistory::new_wit

Error message

index route does not exist:
{}
 use LiveviewHistory::new_with_initial_path to set a custom path

What it means

LiveviewHistory's default constructor failed to parse the "/" index route against the user's Routable enum, which defines no matching index route. Construction requires a valid initial path; use new_with_initial_path to start somewhere valid.

Source

Thrown at packages/liveview/src/history.rs:129

    fn session(&self) -> Session {
        Session {
            routes: self.routes.clone(),
            last_visited: self.current_index,
        }
    }
}

impl LiveviewHistory {
    /// Create a [`LiveviewHistory`] in the given scope.
    /// When using a [`LiveviewHistory`] in combination with use_eval, history must be untampered with.
    ///
    /// # Panics
    ///
    /// Panics if the function is not called in a dioxus runtime with a Liveview context.
    pub(crate) fn new(eval: Rc<dyn Fn(&str) -> Eval>) -> Self {
        Self::new_with_initial_path(
            "/".parse().unwrap_or_else(|err| {
                panic!("index route does not exist:\n{}\n use LiveviewHistory::new_with_initial_path to set a custom path", err)
            }),
            eval
        )
    }

    /// Create a [`LiveviewHistory`] in the given scope, starting at `initial_path`.
    /// When using a [`LiveviewHistory`] in combination with use_eval, history must be untampered with.
    ///
    /// # Panics
    ///
    /// Panics if the function is not called in a dioxus runtime with a Liveview context.
    fn new_with_initial_path(initial_path: String, eval: Rc<dyn Fn(&str) -> Eval>) -> Self {
        let (action_tx, mut action_rx) = tokio::sync::mpsc::unbounded_channel::<Action>();

        let timeline = Arc::new(Mutex::new(Timeline::new(initial_path)));
        let updater_callback: Arc<RwLock<Arc<dyn Fn() + Send + Sync>>> =
            Arc::new(RwLock::new(Arc::new(|| {})));

View on GitHub (pinned to 24f6a829df)

Solutions

  1. The initial path matches no index route. Use LiveviewHistory::new_with_initial_path to set an initial path that exists in the Routable enum.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/liveview/src/history.rs:129 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/182bfd1eff5a39e5. Report an issue: GitHub.