ReactiveX/rxjs · error · Error

Scheduler-backed shareReplay is not supported by this Symbol

Error message

Scheduler-backed shareReplay is not supported by this Symbol contract.

What it means

shareReplay in RxJS Next has no scheduler support. A non-undefined 4th positional argument (the legacy scheduler slot) throws immediately.

Source

Thrown at packages/rxjs/src/share-replay.ts:27

  refCount: boolean;
  scheduler?: unknown;
}

declare global {
  interface Observable<T> {
    [shareReplay](config: ShareReplayConfig): Observable<T>;
    [shareReplay](bufferSize?: number, windowTime?: number, scheduler?: unknown): Observable<T>;
  }
}

Observable.prototype[shareReplay] = function <T>(
  this: Observable<T>,
  configOrBufferSize?: ShareReplayConfig | number,
  windowTime = Infinity,
  scheduler?: unknown
): Observable<T> {
  if (scheduler !== undefined) {
    throw new Error('Scheduler-backed shareReplay is not supported by this Symbol contract.');
  }

  let bufferSize = Infinity;
  let refCount = false;

  if (configOrBufferSize && typeof configOrBufferSize === 'object') {
    if (configOrBufferSize.scheduler !== undefined) {
      throw new Error('Scheduler-backed shareReplay is not supported by this Symbol contract.');
    }

    bufferSize = configOrBufferSize.bufferSize ?? Infinity;
    windowTime = configOrBufferSize.windowTime ?? Infinity;
    refCount = configOrBufferSize.refCount ?? false;
  } else {
    bufferSize = configOrBufferSize ?? Infinity;
  }

  return this[share]({

View on GitHub (pinned to 54796b38a5)

Solutions

  1. Drop the scheduler argument: source[shareReplay]({ bufferSize: 1, windowTime: 1000 })
  2. Prefer the config-object form over positional args for clarity
  3. Handle timing via the surrounding pipeline or TestScheduler in tests

Example fix

// before
source[shareReplay](1, 1000, undefined, asyncScheduler);
// after
source[shareReplay]({ bufferSize: 1, windowTime: 1000 });
Defensive patterns

Strategy: validation

Validate before calling

if (arguments.length > 3) throw new TypeError('scheduler not supported');
source[shareReplay]({ bufferSize, windowTime });

Prevention

When it happens

Trigger: source[shareReplay](1, 1000, undefined, asyncScheduler) or any shareReplay call with 4 arguments where the last is a scheduler.

Common situations: RxJS 7 timing-controlled replay code running un-migrated against RxJS Next.

Related errors


AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28). Data as JSON: /api/errors/eecaa4e87b351893. Report an issue: GitHub.