chatboxai/chatbox · warning · Error

MiniMax OAuth timed out waiting for authorization.

Error message

MiniMax OAuth timed out waiting for authorization.

What it means

Thrown when MiniMax's waitForToken() polling loop exhausts its 10-minute deadline without an access_token and without a terminal error from getMiniMaxErrorMessage. The finally block clears pendingUserCode, pendingVerifier, and resets pendingIntervalMs to 2000, so the flow cannot resume — startDeviceFlow must be called again.

Source

Thrown at src/main/oauth/providers/minimax.ts:188

          }

          if (response.ok && payload.access_token) {
            return {
              accessToken: payload.access_token,
              refreshToken: payload.refresh_token,
              expiresAt: toExpiresAt(payload.expired_in),
            }
          }

          const errorMessage = getMiniMaxErrorMessage(payload, text)
          if (!response.ok || errorMessage) {
            throw new Error(`MiniMax OAuth failed: ${errorMessage || text}`)
          }

          intervalMs = Math.min(Math.round(intervalMs * 1.5), 10_000)
        }

        throw new Error('MiniMax OAuth timed out waiting for authorization.')
      } finally {
        pendingUserCode = null
        pendingVerifier = null
        pendingIntervalMs = 2000
      }
    },

    async refreshToken(credentials) {
      if (!credentials.refreshToken) {
        return credentials
      }

      const response = await fetch(`${config.baseUrl}/oauth/token`, {
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/x-www-form-urlencoded',
        },

View on GitHub (pinned to 81571269ad)

Solutions

  1. Catch the timeout and restart the flow via startDeviceFlow() for a fresh user_code.
  2. Surface 'Authorization timed out — please try again' to the user.
  3. If the backoff cap of 10s is starving the window, lower it so more polls fit before the 10-minute deadline.

Example fix

// before
const creds = await provider.waitForToken(signal)

// after
try {
  return await provider.waitForToken(signal)
} catch (e) {
  if (/timed out/i.test(String(e))) {
    const fresh = await provider.startDeviceFlow()
    throw new ReauthRequiredError(fresh)
  }
  throw e
}
Defensive patterns

Strategy: retry

Type guard

function isMiniMaxTimeout(e: unknown): boolean {
  return e instanceof Error && /MiniMax OAuth timed out/i.test(e.message)
}

Try / catch

try {
  return await provider.waitForToken(signal)
} catch (e) {
  if (isMiniMaxTimeout(e)) {
  const fresh = await provider.startDeviceFlow()
  throw new ReauthRequiredError(fresh)
  }
  throw e
}

Prevention

When it happens

Trigger: User never completed authorization at the verification_uri within 10 minutes; user completed it but MiniMax kept returning status==='pending' past the deadline due to backend lag; polling interval backoff (intervalMs * 1.5 capped at 10s) stretched cycles so far that too few requests fit in the window.

Common situations: Backgrounded app; user distracted; slow MiniMax backend keeping responses pending longer than expected; the exponential-ish backoff (1.5x, cap 10s) causing the loop to under-poll.

Understand the failure class

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/1ba74636bdb7bdef. Report an issue: GitHub.