chatboxai/chatbox · error · Error

Unknown error

Error message

Unknown error

What it means

Error "Unknown error" thrown in chatboxai/chatbox.

Source

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

        return res
      } catch (e) {
        if (isAbortError(e, init?.signal)) {
          throw e
        }
        if (e instanceof BaseError) {
          requestError = e
        } else {
          const err = toError(e)
          const origin = getRequestOrigin(url)
          requestError = new NetworkError(err.message, origin)
        }
        await new Promise((resolve) => setTimeout(resolve, 500))
      }
    }
    if (requestError) {
      throw requestError
    } else {
      throw new Error('Unknown error')
    }
  }
}

export async function uploadFile(file: File, url: string) {
  // COS 需要使用原始的 XMLHttpRequest(根据官网示例)
  // 如果使用 fetch,会导致上传的 excel、docx 格式不正确
  return new Promise((resolve, reject) => {
    const xhr = new XMLHttpRequest()
    xhr.open('PUT', url, true)
    xhr.upload.onprogress = () => {
      // do nothing
    }
    xhr.onload = () => {
      if (/^2\d\d$/.test(`${xhr.status}`)) {
        const ETag = xhr.getResponseHeader('etag')
        resolve({ url: url, ETag: ETag })
      } else {

View on GitHub (pinned to 81571269ad)

Solutions

  1. This is a defensive fallback when all retries finished without capturing an error; check logs for the underlying fetch failure.
  2. Verify network connectivity and that the request URL is valid.
  3. Report the issue if reproducible, since it indicates an unrecorded failure path in the retry loop.

Example fix

if (requestError) {
  throw requestError
} else {
  // Unreachable in normal flow; instrument retry loop to always record an error
  throw new Error('Unknown error')
}

When it happens

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

Common situations: Occurs in src/shared/request/request.ts when a caught error has no extractable message and the generic fallback 'Unknown error' is thrown.


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