PrismLibrary/Prism · error · NavigationException

NavigationException.NoPageIsRegistered

NavigationException.NoPageIsRegistered

Error message

NavigationException.NoPageIsRegistered

What it means

When creating a page for a navigation segment, Prism looks the segment name up in the navigation registry through the container; a KeyNotFoundException means no registration exists for that name. Prism converts it to NavigationException.NoPageIsRegistered so callers get a navigation-specific error.

Solutions

  1. Add containerRegistry.RegisterForNavigation<MyPage, MyPageViewModel>() in the app startup/module before navigating
  2. Fix the segment name to match the registered key exactly (check spelling and case)
  3. Ensure every platform target runs the same registration code (App.Start_MAUI path)

Example fix

// before
await _navigationService.NavigateAsync("SettngsPage"); // typo, not registered
// after
containerRegistry.RegisterForNavigation<SettingsPage>();
await _navigationService.NavigateAsync("SettingsPage");
Defensive patterns

Strategy: try-catch

Validate before calling

bool registered = containerRegistry.IsRegistered<Page>(segmentName);
if (!registered) throw new InvalidOperationException($"{segmentName} is not registered for navigation");

Try / catch

try { await _navigationService.NavigateAsync(segment); }
catch (NavigationException ne) when (ne.Message == NavigationException.NoPageIsRegistered) { /* log & route to fallback page */ }

Prevention

When it happens

Trigger: NavigateAsync/GoBackAsync to a page name never passed to RegisterForNavigation; a typo in the URI segment; platform-specific registration missing (e.g. page registered only in one platform's builder).

Common situations: Renaming a page/view model without updating the registration or the navigation URIs; forgetting RegisterForNavigation in a new app-builder module; case mismatches in segment names.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

    protected virtual Page CreatePage(string segmentName)
    {
        try
        {
            var scope = _container.CreateScope();
            var page = (Page)Registry.CreateView(scope, segmentName);

            if (page is null)
                throw new NullReferenceException($"The resolved type for {segmentName} was null. You may be attempting to navigate to a Non-Page type");

            return page;
        }
        catch(NavigationException)
        {
            throw;
        }
        catch(KeyNotFoundException knfe)
        {
            throw new NavigationException(NavigationException.NoPageIsRegistered, segmentName, knfe);
        }
        catch(ViewModelCreationException vmce)
        {
            throw new NavigationException(NavigationException.ErrorCreatingViewModel, segmentName, _pageAccessor.Page, vmce);
        }
        //catch(ViewCreationException viewCreationException)
        //{
        //    if(!string.IsNullOrEmpty(viewCreationException.InnerException?.Message) && viewCreationException.InnerException.Message.Contains("Maui"))
        //        throw new NavigationException(NavigationException.)
        //}
        catch (Exception ex)
        {
            var inner = ex.InnerException;
            while(inner is not null)
            {
                if (inner.Message.Contains("thread with a dispatcher"))
                    throw new NavigationException(NavigationException.UnsupportedMauiCreation, segmentName, _pageAccessor.Page, ex);
                inner = inner.InnerException;

View on GitHub (pinned to 358118cd64)