{"record":{"id":"e6dc4ae2e5d0236a","repo":"PrismLibrary/Prism","slug":"no-child-page-was-found-with-the-key-selectedtab","errorCode":null,"errorMessage":"No Child Page was found with the key '{selectedTab}'.","messagePattern":"No Child Page was found with the key '(.+?)'\\.","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/PageNavigationService.cs","lineNumber":1084,"sourceCode":"            TabbedPageSelectRootTab(tabbedPage, selectedTab);\n        else if (segments.Count() > 1)\n            TabbedPageSelectNavigationChildTab(tabbedPage, segments.First(), segments.Last());\n    }\n\n    private void TabbedPageSelectRootTab(TabbedPage tabbedPage, string selectedTab)\n    {\n        var registry = Registry;\n        var selectRegistration = registry.Registrations.FirstOrDefault(x => x.Name == selectedTab);\n        Page child = null;\n        if (selectRegistration is null)\n        {\n            child = tabbedPage.Children.FirstOrDefault(x => x.GetType().Name == selectedTab) ??\n                throw new KeyNotFoundException($\"No Registration found to select tab '{selectedTab}'.\");\n        }\n        else\n        {\n            child = tabbedPage.Children.FirstOrDefault(x => IsPage(x, selectRegistration, selectedTab)) ??\n                throw new KeyNotFoundException($\"No Child Page was found with the key '{selectedTab}'.\");\n        }\n\n        tabbedPage.CurrentPage = child;\n    }\n\n    private void TabbedPageSelectNavigationChildTab(TabbedPage tabbedPage, string rootTab, string selectedTab)\n    {\n        var registry = Registry;\n        var rootRegistration = registry.Registrations.FirstOrDefault(x => x.Name == rootTab);\n        var selectRegistration = registry.Registrations.FirstOrDefault(x => x.Name == selectedTab);\n\n        var candidates = tabbedPage.Children\n            .OfType<NavigationPage>()\n            .Where(x => IsPage(x, rootRegistration, rootTab));\n        var child = candidates.SingleOrDefault(x => IsPage(x.RootPage, selectRegistration, selectedTab)) ??\n            candidates.SingleOrDefault(x => IsPage(x.CurrentPage, selectRegistration, selectedTab));\n\n        if (child is not null)","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs#L1066-L1102","documentation":"Prism's PageNavigationService throws this when navigating to a TabbedPage with a deep-link segment (~/TabbedPage/ChildPage or ?selectedTab=...) and no child page in the tabbed page's Children collection matches the requested name. The match is done either by page type name or registration key; if neither matches, there is nothing to select as CurrentPage.","triggerScenarios":"Calling navigationService.NavigateAsync(\"TabbedPage/SomeChild\") or NavigateAsync(\"TabbedPage?selectedTab=SomeChild\") where 'SomeChild' is neither the type name of any child page nor matches IsPage (registration name) for any tabbed child.","commonSituations":"Typo or casing mismatch in the child page name; child view was registered under a different name than the view class; tab child was added/removed in code or XAML so the deep link refers to a page that no longer exists; using the navigation URI path segment when only a registration name matches (or vice versa).","solutions":["Make the deep-link segment exactly match the child page's class name or its registered navigation name (case matters via type Name comparison).","Verify each tab child view is registered in the DI container with the name used in the URI (viewForNavigation).","Inspect tabbedPage.Children at runtime to confirm which pages actually exist as tabs.","If you add tabs dynamically, build the navigation URI from the actual child names instead of a hard-coded string."],"exampleFix":"// before\nawait _navigationService.NavigateAsync(\"MainTabbedPage/DetailsPage\");\n\n// after - match the actual child page type/registration name\nawait _navigationService.NavigateAsync(\"MainTabbedPage/DetailPage\");","handlingStrategy":"validation","validationCode":"var childName = \"DetailPage\";\nvar hasChild = App.Current.MainPage is TabbedPage tp && tp.Children\n    .Any(c => c.GetType().Name == childName);\nif (!hasChild) return; // skip or log the deep link\nawait _navigationService.NavigateAsync($\"MainTabbedPage/{childName}\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep tab child registration names identical to the segment used in navigation URIs.","Test deep links after every change to the tabbed page's children.","Build deep-link segments from a shared constant, not string literals."],"tags":["navigation","xamarin-maui","tabbed-page","deep-linking"],"backgroundTag":"resource-not-found","analyzedSha":"358118cd640d9a22ff8cf21c8ad197fa038b7990","analyzedAt":"2026-09-15T15:00:31.079Z","contentChangedAt":"2026-09-15T15:00:31.079Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}