{"record":{"id":"611b97352807918d","repo":"DioxusLabs/dioxus","slug":"index-route-does-not-exist-err-use-memoryhisto","errorCode":null,"errorMessage":"index route does not exist:\n{err}\n use MemoryHistory::with_initial_path to set a custom path","messagePattern":"index route does not exist:\n(.+?)\n use MemoryHistory::with_initial_path to set a custom path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/history/src/memory.rs","lineNumber":48,"sourceCode":"    /// # #[component]\n    /// # fn OtherPage() -> Element { VNode::empty() }\n    /// #[derive(Clone, Routable, Debug, PartialEq)]\n    /// enum Route {\n    ///     #[route(\"/\")]\n    ///     Index {},\n    ///     #[route(\"/some-other-page\")]\n    ///     OtherPage {},\n    /// }\n    ///\n    /// let mut history = dioxus_history::MemoryHistory::with_initial_path(Route::Index {});\n    /// assert_eq!(history.current_route(), Route::Index {}.to_string());\n    /// assert_eq!(history.can_go_back(), false);\n    /// ```\n    pub fn with_initial_path(path: impl ToString) -> Self {\n        Self {\n            state: MemoryHistoryState{\n                current: path.to_string().parse().unwrap_or_else(|err| {\n                    panic!(\"index route does not exist:\\n{err}\\n use MemoryHistory::with_initial_path to set a custom path\")\n                }),\n                history: Vec::new(),\n                future: Vec::new(),\n            }.into(),\n            base_path: None,\n        }\n    }\n\n    /// Set the base path for the history. All routes will be prefixed with this path when rendered.\n    ///\n    /// ```rust\n    /// # use dioxus_history::*;\n    /// let mut history = MemoryHistory::default().with_prefix(\"/my-app\");\n    ///\n    /// // The base path is set to \"/my-app\"\n    /// assert_eq!(history.current_prefix(), Some(\"/my-app\".to_string()));\n    /// ```\n    pub fn with_prefix(mut self, prefix: impl ToString) -> Self {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/history/src/memory.rs#L30-L66","documentation":"MemoryHistory tried to resolve the index route (\"/\") but the user's Routable enum has no route matching that path. The default constructor parses \"/\"; when the app defines no index route, construction fails and suggests with_initial_path to supply a valid starting route.","triggerScenarios":"Thrown at packages/history/src/memory.rs:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The initial path matches no index route. Use MemoryHistory::with_initial_path to set an initial path that exists in the Routable enum."],"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-14T00:17:10.932Z"}