PrismLibrary/Prism · error · KeyNotFoundException

No Registration found to select tab

Error message

No Registration found to select tab '{selectedTab}'.

What it means

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 ...'.

Solutions

  1. Ensure the requested tab name matches either the RegisterForNavigation key or the exact type name of a child page already in the TabbedPage
  2. Pre-populate the TabbedPage (CreateTab for each tab) before selecting, since lazy tabs aren't in Children yet
  3. Catch KeyNotFoundException and log the available tab names to diagnose mismatches

Example fix

// before
await _navigationService.NavigateAsync("TabbedPage?selectedTab=Settings"); // no 'Settings' child/registration
// after
containerRegistry.RegisterForNavigation<SettingsPage>("Settings");
await _navigationService.NavigateAsync("TabbedPage?selectedTab=Settings");
Defensive patterns

Strategy: validation

Validate before calling

bool tabExists = tabbedPage.Children.Any(c => c.GetType().Name == selectedTab)
    || registry.Registrations.Any(r => r.Name == selectedTab);
if (!tabExists) throw new ArgumentException($"Unknown tab '{selectedTab}'");

Try / catch

try { await _navigationService.NavigateAsync($"TabbedPage?selectedTab={tab}"); }
catch (KeyNotFoundException knfe) when (knfe.Message.StartsWith("No Registration found")) { /* log child names, correct tab key */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of PrismLibrary/Prism@358118cd64 (2026-09-15). Data as JSON: /api/errors/24ac4a84ac035b58. Report an issue: GitHub.

Appendix: source

Thrown at src/Maui/Prism.Maui/Navigation/PageNavigationService.cs:1079

            || string.IsNullOrEmpty(selectedTab))
            return;

        var segments = selectedTab.Split('|').Where(x => !string.IsNullOrEmpty(x));
        if (segments.Count() == 1)
            TabbedPageSelectRootTab(tabbedPage, selectedTab);
        else if (segments.Count() > 1)
            TabbedPageSelectNavigationChildTab(tabbedPage, segments.First(), segments.Last());
    }

    private void TabbedPageSelectRootTab(TabbedPage tabbedPage, string selectedTab)
    {
        var registry = Registry;
        var selectRegistration = registry.Registrations.FirstOrDefault(x => x.Name == selectedTab);
        Page child = null;
        if (selectRegistration is null)
        {
            child = tabbedPage.Children.FirstOrDefault(x => x.GetType().Name == selectedTab) ??
                throw new KeyNotFoundException($"No Registration found to select tab '{selectedTab}'.");
        }
        else
        {
            child = tabbedPage.Children.FirstOrDefault(x => IsPage(x, selectRegistration, selectedTab)) ??
                throw new KeyNotFoundException($"No Child Page was found with the key '{selectedTab}'.");
        }

        tabbedPage.CurrentPage = child;
    }

    private void TabbedPageSelectNavigationChildTab(TabbedPage tabbedPage, string rootTab, string selectedTab)
    {
        var registry = Registry;
        var rootRegistration = registry.Registrations.FirstOrDefault(x => x.Name == rootTab);
        var selectRegistration = registry.Registrations.FirstOrDefault(x => x.Name == selectedTab);

        var candidates = tabbedPage.Children
            .OfType<NavigationPage>()

View on GitHub (pinned to 358118cd64)