{"record":{"id":"057396660e1fccce","repo":"PrismLibrary/Prism","slug":"navigationexception-nopageisregistered-057396","errorCode":"NavigationException.NoPageIsRegistered","errorMessage":"NavigationException.NoPageIsRegistered","messagePattern":"NavigationException\\.NoPageIsRegistered","errorType":"exception","errorClass":"NavigationException","httpStatus":null,"severity":"error","filePath":"src/Maui/Prism.Maui/Navigation/PageNavigationService.cs","lineNumber":947,"sourceCode":"    protected virtual Page CreatePage(string segmentName)\n    {\n        try\n        {\n            var scope = _container.CreateScope();\n            var page = (Page)Registry.CreateView(scope, segmentName);\n\n            if (page is null)\n                throw new NullReferenceException($\"The resolved type for {segmentName} was null. You may be attempting to navigate to a Non-Page type\");\n\n            return page;\n        }\n        catch(NavigationException)\n        {\n            throw;\n        }\n        catch(KeyNotFoundException knfe)\n        {\n            throw new NavigationException(NavigationException.NoPageIsRegistered, segmentName, knfe);\n        }\n        catch(ViewModelCreationException vmce)\n        {\n            throw new NavigationException(NavigationException.ErrorCreatingViewModel, segmentName, _pageAccessor.Page, vmce);\n        }\n        //catch(ViewCreationException viewCreationException)\n        //{\n        //    if(!string.IsNullOrEmpty(viewCreationException.InnerException?.Message) && viewCreationException.InnerException.Message.Contains(\"Maui\"))\n        //        throw new NavigationException(NavigationException.)\n        //}\n        catch (Exception ex)\n        {\n            var inner = ex.InnerException;\n            while(inner is not null)\n            {\n                if (inner.Message.Contains(\"thread with a dispatcher\"))\n                    throw new NavigationException(NavigationException.UnsupportedMauiCreation, segmentName, _pageAccessor.Page, ex);\n                inner = inner.InnerException;","sourceCodeStart":929,"sourceCodeEnd":965,"githubUrl":"https://github.com/PrismLibrary/Prism/blob/358118cd640d9a22ff8cf21c8ad197fa038b7990/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs#L929-L965","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add containerRegistry.RegisterForNavigation<MyPage, MyPageViewModel>() in the app startup/module before navigating","Fix the segment name to match the registered key exactly (check spelling and case)","Ensure every platform target runs the same registration code (App.Start_MAUI path)"],"exampleFix":"// before\nawait _navigationService.NavigateAsync(\"SettngsPage\"); // typo, not registered\n// after\ncontainerRegistry.RegisterForNavigation<SettingsPage>();\nawait _navigationService.NavigateAsync(\"SettingsPage\");","handlingStrategy":"try-catch","validationCode":"bool registered = containerRegistry.IsRegistered<Page>(segmentName);\nif (!registered) throw new InvalidOperationException($\"{segmentName} is not registered for navigation\");","typeGuard":null,"tryCatchPattern":"try { await _navigationService.NavigateAsync(segment); }\ncatch (NavigationException ne) when (ne.Message == NavigationException.NoPageIsRegistered) { /* log & route to fallback page */ }","preventionTips":["Centralize page registrations and navigate only to names from that list","Add a startup self-test that resolves every registered page","Grep navigation URIs against the registration list in CI"],"tags":["prism","maui","navigation","dependency-injection"],"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"}