diegosouzapw/OmniRoute · error · CircuitBreakerOpenError

Circuit breaker " " is OPEN. Try again later.

Error message

Circuit breaker "${this.name}" is OPEN. Try again later.

What it means

CircuitBreakerOpenError thrown by execute() when the breaker for this dependency is in the OPEN state: recent failures crossed the threshold and calls are being shed until the (escalated) reset timeout elapses. The error carries the provider name and timeUntilReset so callers can back off deliberately.

Solutions

  1. Catch CircuitBreakerOpenError and skip/route around the provider until retryAfterMs elapses
  2. Let combo/fallback routing select another target instead of waiting
  3. Investigate the upstream failures that opened the breaker (see provider health/error logs)
  4. Do not hammer execute() — the breaker resets lazily and will admit a probe at HALF_OPEN
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/shared/utils/circuitBreaker.ts:270 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/75bb4d660911087e. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/utils/circuitBreaker.ts:270

   * Get the effective reset timeout, escalated by open cycle count.
   * Each open→half_open→open cycle multiplies the timeout.
   */
  _effectiveResetTimeout(): number {
    if (this.openCycleCount <= this.backoffEscalationCount) {
      return this.resetTimeout;
    }
    const escalationFactor = Math.pow(2, this.openCycleCount - this.backoffEscalationCount);
    return Math.min(
      this.resetTimeout * escalationFactor,
      this.resetTimeout * this.maxBackoffMultiplier
    );
  }

  async execute<T>(fn: () => Promise<T>): Promise<T> {
    this._refreshOpenState();

    if (this.state === STATE.OPEN) {
      throw new CircuitBreakerOpenError(
        `Circuit breaker "${this.name}" is OPEN. Try again later.`,
        this.name,
        this._timeUntilReset()
      );
    }

    if (this.state === STATE.HALF_OPEN && this.halfOpenAllowed <= 0) {
      throw new CircuitBreakerOpenError(
        `Circuit breaker "${this.name}" is HALF_OPEN, no more probe requests allowed.`,
        this.name,
        this._timeUntilReset()
      );
    }

    if (this.state === STATE.HALF_OPEN) {
      this.halfOpenAllowed--;
    }

View on GitHub (pinned to a179ffed5b)