You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[go_router] Cannot distinguish a blocked initial deep link from other routing errors in onException #189581
Apps using onEnter for async guards (entitlements, permissions, feature flags) sometimes need to block the very first navigation — e.g. a deep link on web arrives before the guard's data is cached, so onEnter returns Block.stop().
When that happens there is no prior route to restore, and the parser reports a generic GoException('Navigation to ... was blocked by onEnter with no prior route to restore') through onException. The app wants to recover differently depending on the cause: redirect a blocked deep link to a loading screen with the original location preserved, but send genuine 404s and other routing errors to a fallback screen. Today the only way to tell them apart is string matching on the exception message, which breaks silently if the message ever changes.
Proposal
Add a typed BlockedInitialNavigationException extends GoException, raised in that specific code path. Existing is GoException checks keep working; apps can opt into if (state.error is BlockedInitialNavigationException) in onException.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
mbcorona commentedon Jul 16, 2026
Thanks for the proposal and linked PR.
Routing to the framework team; PR flutter/packages#12213 is linked. Related to #189582.
[go_router] Add BlockedInitialNavigationException for blocked initial…
github-actions commentedon Aug 12, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.