{"record":{"id":"b284ae06e09b9e89","repo":"dotnet/aspnetcore","slug":"circuit-state-this-statename-is-not-in-progres","errorCode":null,"errorMessage":"Circuit state ${this._stateName} is not in progress","messagePattern":"Circuit state (.+?) is not in progress","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts","lineNumber":732,"sourceCode":"      throw new Error(`Circuit state ${this._stateName} not initialized`);\n    }\n\n    const reject = this._reject;\n\n    this._promise = undefined;\n    this._resolve = undefined;\n    this._reject = undefined;\n\n    reject(reason);\n  }\n\n  public isInprogress(): boolean {\n    return !!this._promise;\n  }\n\n  public currentProgress(): Promise<T> {\n    if (!this.isInprogress()) {\n      throw new Error(`Circuit state ${this._stateName} is not in progress`);\n    }\n\n    return this._promise!;\n  }\n\n  public transitionTo(newState: T): void {\n    if (this._promise) {\n      throw new Error(`Circuit state ${this._stateName} is in progress`);\n    }\n\n    this._lastValue = newState;\n  }\n\n  public lastValue() {\n    return this._lastValue;\n  }\n}\n","sourceCodeStart":714,"sourceCodeEnd":750,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/src/Components/Web.JS/src/Platform/Circuits/CircuitManager.ts#L714-L750","documentation":"`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.","triggerScenarios":"Calling `currentProgress()` on a `CircuitState` that has not been started with `reset()`, or whose operation already completed/failed and cleared the promise.","commonSituations":"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.","solutions":["Check `isInprogress()` before awaiting `currentProgress()`.","Start the operation with `reset()` first when you need something to await.","Restructure callers to track whether they initiated the operation rather than blindly awaiting it.","Return early/no-op when no operation is in progress instead of forcing an await."],"exampleFix":"// before\nawait this._disconnectingState.currentProgress(); // throws if not disconnecting\n\n// after\nif (this._disconnectingState.isInprogress()) {\n  await this._disconnectingState.currentProgress();\n}","handlingStrategy":"validation","validationCode":"async function awaitProgress<T>(s: { isInprogress(): boolean; currentProgress(): Promise<T> }): Promise<T | undefined> {\n  return s.isInprogress() ? s.currentProgress() : undefined;\n}","typeGuard":null,"tryCatchPattern":"try { await state.currentProgress(); }\ncatch (e) { if (/not in progress/.test(e.message)) { return; } throw e; }","preventionTips":["Check isInprogress() before awaiting currentProgress().","Call reset() first when you need something to await.","Track whether you initiated the operation before awaiting.","No-op early when nothing is in flight."],"tags":["circuit","state-machine","lifecycle","blazor-server"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}