dotnet/aspnetcore · error · Error

Circuit state ${this._stateName} is not in progress

Error message

Circuit state ${this._stateName} is not in progress

What it means

`currentProgress()` returns the in-flight promise so callers can await an ongoing pause/resume/disconnect. It throws when `isInprogress()` is false (no `_promise` set) — awaiting progress of an operation that was never started is a programming error, not a waitable condition.

Source

Thrown at src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts:732

      throw new Error(`Circuit state ${this._stateName} not initialized`);
    }

    const reject = this._reject;

    this._promise = undefined;
    this._resolve = undefined;
    this._reject = undefined;

    reject(reason);
  }

  public isInprogress(): boolean {
    return !!this._promise;
  }

  public currentProgress(): Promise<T> {
    if (!this.isInprogress()) {
      throw new Error(`Circuit state ${this._stateName} is not in progress`);
    }

    return this._promise!;
  }

  public transitionTo(newState: T): void {
    if (this._promise) {
      throw new Error(`Circuit state ${this._stateName} is in progress`);
    }

    this._lastValue = newState;
  }

  public lastValue() {
    return this._lastValue;
  }
}

View on GitHub (pinned to 3600ca084e)

Solutions

  1. Check `isInprogress()` before awaiting `currentProgress()`.
  2. Start the operation with `reset()` first when you need something to await.
  3. Restructure callers to track whether they initiated the operation rather than blindly awaiting it.
  4. Return early/no-op when no operation is in progress instead of forcing an await.

Example fix

// before
await this._disconnectingState.currentProgress(); // throws if not disconnecting

// after
if (this._disconnectingState.isInprogress()) {
  await this._disconnectingState.currentProgress();
}
Defensive patterns

Strategy: validation

Validate before calling

async function awaitProgress<T>(s: { isInprogress(): boolean; currentProgress(): Promise<T> }): Promise<T | undefined> {
  return s.isInprogress() ? s.currentProgress() : undefined;
}

Try / catch

try { await state.currentProgress(); }
catch (e) { if (/not in progress/.test(e.message)) { return; } throw e; }

Prevention

When it happens

Trigger: Calling `currentProgress()` on a `CircuitState` that has not been started with `reset()`, or whose operation already completed/failed and cleared the promise.

Common situations: A reconnect/disconnect handler awaiting a state that was never initiated; calling code assuming an operation is in progress when the server never confirmed it; a code path reached after settlement that still tries to await.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/b284ae06e09b9e89. Report an issue: GitHub.