Vaadin forwardTo doesnt redirect appropriately

I’m attempting to have my custom RouteNotFoundError redirect back to the “home” view.

When the redirect happens I can see the URL briefly change to “home” but then it goes back to whatever garbage i put in…Can someone please tell me whats wrong here?

public class CustomRouteNotFoundError extends RouteNotFoundError {

	public CustomRouteNotFoundError() {
		System.out.println("Route not found.");

	public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) {
            return HttpServletResponse.SC_NOT_FOUND;
@Route(value = "home", layout = MainLayout.class)
@RouteAlias(value = IdeaConst.PAGE_ROOT, layout = MainLayout.class)
public class Home extends ViewFrame {

    public Home() {

    private Component createContent() {
		FlexBoxLayout content = new FlexBoxLayout();
        return content;

I tried event.rerouteTo("home"); and that reroutes appropriately but the URL doesnt change.

However event.forwardTo("home"); doesnt do either with used in the way listed above.

I think your finding is somewhat linked to this ticket on GitHub issue tracker

It is definitely somewhat linked, as the behavior is the same.

However the work around indicated in the bug doesn’t work in my case.

The best I could do is add a check prior to navigation that checks if the destination route is valid, and if not, reroute back to home?