Skip to content

retryBackoff: an empty caughtError Observable ends the stream, and only its first value is emitted #282

Open

Description

@mbret

What happens

The docs say: "The values of the Observable it returns are emitted before the retry". Two cases do not do this.

Reproduced in reactjrx tests:

  • caughtError: () => EMPTY, on a source that succeeds when subscribed the second time: 1 subscription, where 2 are expected. The stream completes, the error is lost, and there is no retry.
  • caughtError: () => of("a", "b"): emits ["a"], where ["a", "b"] is expected.

Why

retryBackoff.ts:74-81 rethrows the error with each value, through mergeMap((value) => merge(of(value), throwError(...))). The first value rethrows and ends the Observable, and an Observable with no value never rethrows.

Fix

Emit all the values, then rethrow: concat(caughtErrorResult$, throwError(() => error)). No API change.

Related: when retryAfter completes without a value, the original error is replaced by an rxjs EmptyError. A test pins this today ("errors with EmptyError when retryAfter completes without emitting"), but it loses the error that the caller would want.

Activity

  1. added
    bug
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions