dotnet/aspnetcore · error · Error
Circuit state ${this._stateName} is in progress
Error message
Circuit state ${this._stateName} is in progress What it means
`transitionTo(newState)` synchronously moves a settled `CircuitState`'s last value (e.g. marking a circuit 'paused' when the connection drops without a formal pause). It refuses if `_promise` exists, because transitioning while an operation is in flight would race the async settlement — the value should be set by `complete()` instead.
Source
Thrown at src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts:740
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
- Only call `transitionTo()` when `isInprogress()` is false — defer it until the operation settles.
- If you need to set the value during an in-flight operation, let `complete()`/`fail()` set it instead.
- Serialize lifecycle transitions so a new transition does not start before the previous one settles.
- Review connection close/open handlers for races against explicit pause/resume calls.
Example fix
// before
this._pausingState.transitionTo(true); // throws if a pause is in flight
// after
if (!this._pausingState.isInprogress()) {
this._pausingState.transitionTo(true);
} Defensive patterns
Strategy: validation
Validate before calling
function safeTransition<T>(s: { isInprogress(): boolean; transitionTo(v: T): void }, v: T) {
if (!s.isInprogress()) s.transitionTo(v);
} Try / catch
try { state.transitionTo(newState); }
catch (e) { if (/is in progress/.test(e.message)) { /* defer until settled */ return; } throw e; } Prevention
- Only transitionTo() when isInprogress() is false.
- Let complete()/fail() set the value during in-flight operations.
- Serialize lifecycle transitions.
- Audit close/open handlers for races against pause/resume.
When it happens
Trigger: Calling `transitionTo()` on a `CircuitState` that currently has an in-flight operation (an unsettled `_promise` from `reset()`).
Common situations: Internal logic attempting to mark a state (e.g. paused) while a pause/resume/disconnect is still resolving; a connection-close handler racing with an explicit pause; re-entrant lifecycle calls during reconnect.
Related errors
- Circuit state ${this._stateName} is already in progress
- Circuit state ${this._stateName} not initialized
- Circuit state ${this._stateName} is not in progress
- Cannot start the circuit until Blazor Server has started.
- Cannot start a disposed circuit.
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/640bc77c37f7396d.
Report an issue: GitHub.