chatboxai/chatbox · error · ApiError

No authentication tokens available

Error message

No authentication tokens available

What it means

Error "No authentication tokens available" thrown in chatboxai/chatbox.

Source

Thrown at src/shared/request/request.ts:216

export function createAuthenticatedAfetch(config: AuthenticatedAfetchConfig) {
  const { platformInfo, getTokens, refreshTokens, clearTokens } = config

  // 用于防止并发刷新 token
  let refreshPromise: Promise<AuthTokens> | null = null

  return async function authenticatedAfetch(
    url: RequestInfo | URL,
    init?: RequestInit,
    options: {
      retry?: number
      parseChatboxRemoteError?: boolean
    } = {}
  ) {
    // 获取当前 tokens
    const tokens = await getTokens()
    if (!tokens) {
      throw new ApiError('No authentication tokens available')
    }

    // 构建包含 token 的 headers 的辅助函数
    function buildHeaders(accessToken: string) {
      const authHeaders: Record<string, string> = {
        'x-chatbox-access-token': accessToken,
      }

      if (isChatboxAPI(url)) {
        authHeaders['CHATBOX-PLATFORM'] = platformInfo.platform
        authHeaders['CHATBOX-PLATFORM-TYPE'] = platformInfo.type
        authHeaders['CHATBOX-OS'] = platformInfo.os
        authHeaders['CHATBOX-VERSION'] = platformInfo.version
      }

      return {
        ...init?.headers,
        ...authHeaders,

View on GitHub (pinned to 81571269ad)

Solutions

  1. Sign in to the Chatbox account again to obtain new authentication tokens.
  2. Check that token storage is working (not cleared by another process or private mode).
  3. If tokens were recently revoked server-side, re-authenticate.

Example fix

const tokens = await getTokens()
if (!tokens) {
  // Redirect user to login flow
  throw new ApiError('No authentication tokens available')
}

When it happens

Trigger: Thrown at src/shared/request/request.ts:216 when the library encounters an invalid state.

Common situations: Occurs in src/shared/request/request.ts when an authenticated request is attempted but no access token is stored; the user must log in again.

Understand the failure class


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