angular/angular · warning

NG0506

NG0506

Error message

Angular hydration expected the ApplicationRef.isStable() to emit `true`, but it didn't happen within ${time}ms. Angular hydration logic depends on the application becoming stable as a signal to complete hydration process.

What it means

NG0506: after hydration begins, Angular waits for ApplicationRef.isStable() to emit true (i.e., no pending tasks) to finish the hydration process, guarded by a timeout of APPLICATION_IS_STABLE_TIMEOUT = 10_000 ms (packages/core/src/hydration/api.ts:85). If the application never becomes stable within 10 seconds, this warning fires — hydration may still complete later, but something is keeping the app permanently unstable.

Source

Thrown at packages/core/src/hydration/api.ts:397

        multi: true,
      },
    );
  }

  return providers;
}

/**
 *
 * @param time The time in ms until the stable timedout warning message is logged
 */
function logWarningOnStableTimedout(time: number, console: Console): void {
  const message =
    `Angular hydration expected the ApplicationRef.isStable() to emit \`true\`, but it ` +
    `didn't happen within ${time}ms. Angular hydration logic depends on the application becoming stable ` +
    `as a signal to complete hydration process.`;

  console.warn(formatRuntimeError(RuntimeErrorCode.HYDRATION_STABLE_TIMEDOUT, message));
}

View on GitHub (pinned to 51cb07e980)

Solutions

  1. Find the task keeping the app unstable: check ApplicationRef.isStable()/whenStable(), pending tasks via provideStabilityDebugging, and the PendingTasks service
  2. Move long-lived or periodic work outside change detection (NgZone.runOutsideAngular) or stop registering it as a pending task
  3. Complete/cancel infinite observables or gate them so the app can settle initially, then restart them after hydration

Example fix

// before
startPolling() {
  this.zone.run(() => setInterval(() => this.poll(), 1000)); // keeps app unstable forever
}

// after
startPolling() {
  this.zone.runOutsideAngular(() => setInterval(() => this.poll(), 1000));
}
Defensive patterns

Strategy: validation

Validate before calling

// Surface never-stable apps before hydration times out at 10s
const appRef = injector.get(ApplicationRef);
firstValueFrom(appRef.isStable().pipe(filter(Boolean), timeout(9000)))
  .catch(() => console.warn('App unstable >9s — investigate pending tasks before enabling hydration'));

Prevention

When it happens

Trigger: An app that never settles: a never-completing RxJS stream piped through async pipe, an interval timer running inside the Angular zone, a PendingTask never removed, pending HTTP requests that hang, or an APP_INITIALIZER that never resolves — all while hydration is enabled.

Common situations: Polling loops (setInterval in zone), realtime websocket subscriptions registered as pending tasks, a forgotten task added via PendingTasks and never completed, or long initial data loads exceeding 10 seconds on slow networks.

Related errors


AI-assisted analysis of angular/angular@51cb07e980 (2026-08-22). Data as JSON: /api/errors/5a406001eb5db160. Report an issue: GitHub.