ui-router: Error: transition superseded

Am getting this error Error: transition superseded how can I solve it

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 73
  • Comments: 40 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Same here, my root state is loaded but when I try to access another state I get Error: transition superseded for any and all states.

Angular - 1.3.7 Ang-UI-Router - 0.2.18

Can you guys put your version of angular & ui-router

Once I upgraded to Angular-UI-Router - 0.3.2

Started working fine.

it starts to yelling me that when updating my app to angular 1.6.1

Just wanted to add to the tally of people who upgraded to AngularJS 1.6.1 and UI-Router 0.3.2 who are consistently getting the “Error: transition superseded” in the console.

FWIW, I had an old version of angular-ui-router. When I updated angular-ui-router, the issue went away. Did this fix anyone else?

The issue was fixed in UI-Router 0.4.2. Update. See issue #3120

Transition superseded is probably caused by a bug in your code.

A transition is a long running operation (due to async processes, etc). Transition superseded means that there was a transition #1 started and it hasn’t yet completed. While it was running, a new transition #2 was also started. Transition #2 supersedes Transition #1. The promise for the transition is rejected with the message “Error: Transition Superseded” so you know the original transition is now aborted.

This is normal behavior if you start a transition, then supersede it with a new transition.


I’m not sure what would print the error message (I don’t think we log anything like that in ui-router 0.2.x).

In ui-router 1.0 we have a defaultErrorHandler which logs errors to the console, including Transition Superseded. If you don’t want to log Transition Superseded in ui-router 1.0, you should customize the $state.defaultErrorHandler() and filter out errors that look like the Transition Superseded ones.

Closing because this is probably not a bug. However, I’ll reopen if a reproduction can be posted that demonstrates a bug.

It’d be super helpful if the error message for superseded transitions had information about what transition of fromState->toState collided with what other transition from fromState2->toState2.

I get that error before but i upgrade my angular and ui-router and the error gone. angular: 1.6.2 ui-router: 0.4.2

I had this error today … I fixed it by changing the versions of angular.min.js to 1.5.8 and angular-ui-router.js to 0.2.10

try angular version: 1.5.1 and angular-ui-router: 0.2.18 that combination works fine for example if you are using bower: bower install angular#1.5.1 bower install angular-ui-router#0.2.18

The version to be on is either 0.4.2 or 1.0.0-rc.1

Just wanted to chime in here, because I was getting maddening Transition Superseded errors when I tried to navigate to perfectly valid routes with valid params via traditional means: just clicking through tabs until I got there… but I was always being redirected to my otherwise state. (I was, however, able to directly input the full url and access the state without being redirected.)

Background: I had just upgraded my angular 1.5.8 application from ui-router 0.3.1 to 1.0.0-rc1 and was going through the migration guide and googling around to fix bugs as they arose, and I came across this (admittedly outdated) summary of breaking changes and followed down the path of depending on the ui.router.state.events module to be able to keep the $stateChange events I had been using with the previous version. Soon after I decided to implement proper $transition hooks and cross check that the hooks I put in place were accomplishing the same purpose that the $stateChange events had been doing prior. Satisfied that the hooks were working properly, I removed all the $stateChange event listeners.

HOWEVER, I didn’t think to also remove the dependency on ui.router.state.events, and while angular never errored because of the now-unused dependency, there must have been some mischief happening under the hood, because after more than a week of googling in vain, I finally got around to discarding ui.router.state.events from my dependencies, and suddenly I could navigate to the desired states without issue.

I might just be an idiot unicorn, but if there happen to exist more people out there like me, maybe this will save you some time and a fistful of hair.

@justinotero I fixed it, look!! http://stackoverflow.com/questions/41450712/angularjs-and-ui-router-error-transition-superseded-during-angularjs-unit-te/41515812#41515812

you need to update both angular and the ui-router

I had the same error with the first page load and v0.2.18 of angular-ui-router. But when navigated from url to url it was okay. I’ve found the reason: behaviour of $q.reject changed. In later versions of angular it immediately throws error in console log when you create it. I.e. following lines write erros to console:

var TransitionSuperseded = $q.reject(new Error('transition superseded')); 
var TransitionPrevented = $q.reject(new Error('transition prevented')); 
var TransitionAborted = $q.reject(new Error('transition aborted')); 
var TransitionFailed = $q.reject(new Error('transition failed')); 

I’ve changed this lines:

var TransitionSuperseded = function () { return $q.reject(new Error('transition superseded')); };
var TransitionPrevented = function () { return $q.reject(new Error('transition prevented')); };
var TransitionAborted = function () { return $q.reject(new Error('transition aborted')); };
var TransitionFailed = function () { return $q.reject(new Error('transition failed')); };

And changed in other lines TransitionSuperseded to TransitionSuperseded(). This fixed errors.

I followed @SensationSama suggestion and the problem has solved for me. Before, I updated the angular-animate to 1.6.2 version.

Performing bower install angular-ui-router completed the update and resolved this issue, for me.

So, the bower has been like below: "angular": "1.6.4", "angular-animate": "1.6.2", "angular-ui-router": "0.4.2"

I was using angular.module('myApp').run(appRun); appRun.$inject = ['$state']; function appRun($state) { $state.go('home'); } In my app config file. As I removed the logic from app.run, it got fixed.

I’m also getting this error - is there a way to fix this with Angular 1.6.1?

@blackendstudios Don’t update angular, try updating Angular UI Router. I am running Angular 1.3.7 with updated Angular UI Router of 0.3.2 and I am not longer seeing Error: transition superseded

The problem was that I was using $state.go in one of my controllers. A solution, that worked for me can be found here: https://stackoverflow.com/questions/42659302/angular-ui-router-1-0-0rc-transition-superseded-on-a-redirect#answer-44654316

The promise for the transition is rejected with the message “Error: Transition Superseded” so you know the original transition is now aborted.

I’m OK with aborting the original transition (the logic to go to a different state is legit), but is there a way to “gently abort” the original transition before calling $state.target, so that an error is not produced?

This happens to me when i open a state directly by opening a page that is registered as a state. For example: http://localhost:9000/#/myURL. When im opening it with a link that is on the page (ui-sref="myURL") then it doesn’t show up.
Im using: “angular-ui-router”: “^1.0.12”, “angular”: “^1.6.8”,

See also: https://github.com/angular-ui/ui-router/issues/2889#issuecomment-273368236

0.4.0 release should handle all rejected promises that UI-Router is responsible for including this one.

Yeah, I’m getting it also (angular 1.6.1 and ui-router 0.3.2)