You might wanna have a look at this post.
It may give you what you are looking for.
Hope it helps!!
does the error happen, when navigating to a page, without going through the nav?
often times the nav active state is added on click, but if you navigate to a page but not with the menu, the error can happen