{"record":{"id":"24ac4a84ac035b58","repo":"PrismLibrary/Prism","slug":"no-registration-found-to-select-tab-selectedtab","errorCode":null,"errorMessage":"No Registration found to select tab '{selectedTab}'.","messagePattern":"No Registration found to select tab '(.+?)'\\.","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/PageNavigationService.cs","lineNumber":1079,"sourceCode":"            || string.IsNullOrEmpty(selectedTab))\n            return;\n\n        var segments = selectedTab.Split('|').Where(x => !string.IsNullOrEmpty(x));\n        if (segments.Count() == 1)\n            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>()","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs#L1061-L1097","documentation":"When processing a 'select tab' segment, Prism first looks for a navigation registration whose name equals the requested tab; if none exists it falls back to matching an existing child page by type name, and if neither matches it throws KeyNotFoundException 'No Registration found to select tab ...'.","triggerScenarios":"SelectTabAsync/tab-to URI segment naming a tab that is neither a registered navigation name nor the type name of an existing child of the TabbedPage.","commonSituations":"Tab name typo or casing mismatch; navigating to a tab before the TabbedPage's children exist (tab content is lazy); passing a view-model name instead of the page registration name.","solutions":["Ensure the requested tab name matches either the RegisterForNavigation key or the exact type name of a child page already in the TabbedPage","Pre-populate the TabbedPage (CreateTab for each tab) before selecting, since lazy tabs aren't in Children yet","Catch KeyNotFoundException and log the available tab names to diagnose mismatches"],"exampleFix":"// before\nawait _navigationService.NavigateAsync(\"TabbedPage?selectedTab=Settings\"); // no 'Settings' child/registration\n// after\ncontainerRegistry.RegisterForNavigation<SettingsPage>(\"Settings\");\nawait _navigationService.NavigateAsync(\"TabbedPage?selectedTab=Settings\");","handlingStrategy":"validation","validationCode":"bool tabExists = tabbedPage.Children.Any(c => c.GetType().Name == selectedTab)\n    || registry.Registrations.Any(r => r.Name == selectedTab);\nif (!tabExists) throw new ArgumentException($\"Unknown tab '{selectedTab}'\");","typeGuard":null,"tryCatchPattern":"try { await _navigationService.NavigateAsync($\"TabbedPage?selectedTab={tab}\"); }\ncatch (KeyNotFoundException knfe) when (knfe.Message.StartsWith(\"No Registration found\")) { /* log child names, correct tab key */ }","preventionTips":["Register each tab page with a stable name used in tab selection","Ensure tabs are created (not lazy) before selecting by type name","Use a shared enum/constants for tab keys to avoid typos"],"tags":["prism","maui","navigation","tabbedpage"],"backgroundTag":"record-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"}