angular-cli: ng CLI 1.5.5: ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence

Versions

Angular CLI: 1.5.5
Node: 9.2.0
OS: darwin x64
Angular: 5.0.5

Repro steps

Difficult to reproduce. I guess this is more a question of how to track the bug.

I have an Angular 5 app, which I upgraded from using the CLI from 1.5.0 to 1.5.4. In these versions the bug does not happen.

But with CLI 1.5.5 I do see the bug, when started with the CLI or bundled in a Web-Archive (.WAR file) deployed in an OSGi container.

Observed behavior

ERROR Error: Uncaught (in promise): EmptyError: no elements in sequence
EmptyError: no elements in sequence
    at new EmptyError (EmptyError.js:28)
    at FirstSubscriber._complete (first.js:154)
    at FirstSubscriber.Subscriber.complete (Subscriber.js:122)
    at MergeMapSubscriber._complete (mergeMap.js:150)
    at MergeMapSubscriber.Subscriber.complete (Subscriber.js:122)
    at MapSubscriber.Subscriber._complete (Subscriber.js:140)
    at MapSubscriber.Subscriber.complete (Subscriber.js:122)
    at EmptyObservable._subscribe (EmptyObservable.js:83)
    at EmptyObservable.Observable._trySubscribe (Observable.js:172)
    at EmptyObservable.Observable.subscribe (Observable.js:160)
    at new EmptyError (EmptyError.js:28)
    at FirstSubscriber._complete (first.js:154)
    at FirstSubscriber.Subscriber.complete (Subscriber.js:122)
    at MergeMapSubscriber._complete (mergeMap.js:150)
    at MergeMapSubscriber.Subscriber.complete (Subscriber.js:122)
    at MapSubscriber.Subscriber._complete (Subscriber.js:140)
    at MapSubscriber.Subscriber.complete (Subscriber.js:122)
    at EmptyObservable._subscribe (EmptyObservable.js:83)
    at EmptyObservable.Observable._trySubscribe (Observable.js:172)
    at EmptyObservable.Observable.subscribe (Observable.js:160)
    at resolvePromise (zone.js:824)
    at resolvePromise (zone.js:795)
    at eval (zone.js:873)
    at ZoneDelegate.invokeTask (zone.js:425)
    at Object.onInvokeTask (core.js:4621)
    at ZoneDelegate.invokeTask (zone.js:424)
    at Zone.runTask (zone.js:192)
    at drainMicroTaskQueue (zone.js:602)
    at ZoneTask.invokeTask [as invoke] (zone.js:503)
    at invokeTask (zone.js:1540)

In Chrome Dev Tools, I pause on caught exceptions. Still, I have difficulty in idetifying the cause.

Desired behavior

This happens right in the login page. The page does not change to the first page that is authenticated. I also commented the guard which is used to secure the routes. The error still shows up.

Mention any other details that might be useful (optional)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 19
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

The suggested fix of downgrading “rxjs” to “5.5.2” didn’t worked for me, but the workaround (adding pathMatch: ‘full’) suggested by @fabiogodoy resolved my issue. { path: ‘’, component: HomeComponent, pathMatch: ‘full’ }, { path: ‘about’, component: AboutComponent, pathMatch: ‘full’ }

@nawnitraman when you downgraded rxjs, did you remove node_modules and re-install? I just changed “^5.5.2” to “5.5.2” and the error went away.

I also faced the same issue.

Versions Angular CLI: 1.5.5 Node: 8.9.1 OS: linux x64 Angular: 5.0.5 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router

@angular/cli: 1.5.5 @angular-devkit/build-optimizer: 0.0.34 @angular-devkit/core: 0.0.22 @angular-devkit/schematics: 0.0.38 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.8.5 @schematics/angular: 0.1.8 typescript: 2.4.2 webpack: 3.8.1

Downgrading from rxjs 5.5.3 to 5.5.2 fixed issue for me.

I faced the same issue apply, all possible solution but finally, this solve my problem

export class AppRoutingModule {
constructor(private router: Router) {
	this.router.errorHandler = (error: any) => {
		this.router.navigate(['404']); // or redirect to default route
	}
  }
}

Hope this will help you.

you need add a null component. and add redirect route, like this: { path: '', redirectTo: '/yourNullComponent', pathMatch: 'full' }

For a fix, look for the comment from @kaaterskil in the issue @ericmartinezr linked above.

also have this in newly generated app with 16.0.0.rc1

@austinthedeveloper good catch! It worked after re-install. Thanks.