different-ai/openwork · error · Error

OAuth discovery state was unavailable.

Error message

OAuth discovery state was unavailable.

What it means

Error "OAuth discovery state was unavailable." thrown in different-ai/openwork.

Source

Thrown at packages/enterprise-mcp-client/src/oauth-provider.ts:301

    const persistedState = await this.persistence.discovery?.load(this.context())
    const state = await this.normalizeDiscoveryState(persistedState)
    if (state) {
      this.assertDiscoveryBinding(state)
      // normalizeDiscoveryState returns the same object when nothing needed
      // verification or repair; only a rebuilt state warrants a re-save.
      if (persistedState && state !== persistedState) {
        await this.persistence.discovery?.save({ context: this.context(), state })
      }
      this.loadedDiscovery = state
    }
    return state
  }

  async saveDiscoveryState(state: OAuthDiscoveryState): Promise<void> {
    let normalizedState: OAuthDiscoveryState | undefined
    try {
      normalizedState = await this.normalizeDiscoveryState(state)
      if (!normalizedState) throw new Error("OAuth discovery state was unavailable.")
      this.assertDiscoveryBinding(normalizedState)
    } catch (error) {
      // Only a proven binding violation invalidates persisted discovery and
      // flags issuer review; a transient metadata outage must stay retryable.
      if (error instanceof EnterpriseMcpOAuthContractError) {
        await this.persistence.discovery?.invalidate({
          context: this.context(),
          reason: "issuer-mismatch",
        })
      }
      throw error
    }
    await this.persistence.discovery?.save({ context: this.context(), state: normalizedState })
    this.loadedDiscovery = normalizedState
  }

  async clientInformation(context?: OAuthClientInformationContext): Promise<StoredOAuthClientInformation | undefined> {
    const record = await this.persistence.clientRegistrations.load(this.context())

View on GitHub (pinned to 2b7df46e8a)

When it happens

Trigger: Thrown at packages/enterprise-mcp-client/src/oauth-provider.ts:301 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/0bf9cc28ff8f6dfd. Report an issue: GitHub.