chatboxai/chatbox · error · Error

Too many file IDs requested (max 100)

Error message

Too many file IDs requested (max 100)

What it means

Thrown by postLicense() in native-license.ts when the Chatbox license endpoint (/api/license/activate|validate|deactivate) returns a non-2xx response. The message is either the server-provided `payload.error` string (if the body is `{ error: string }`) or the generic `License request failed with status <code>`. Affects license activation, validation, and deactivation flows on the RN mobile shell and the renderer (via packages/remote).

Source

Thrown at src/main/knowledge-base/ipc-handlers.ts:380

        scope.setExtra('limit', limit)
        sentry.captureException(error)
      })
      throw error
    }
  })

  ipcMain.handle('kb:file:get-metas', async (_event, kbId: number, fileIds: number[]) => {
    try {
      log.debug(`ipcMain: kb:file:get-metas, kbId=${kbId}, fileIds=${fileIds.join(',')}`)

      if (!kbId || kbId <= 0) {
        throw new Error('Invalid knowledge base ID')
      }
      if (!fileIds || fileIds.length === 0) {
        return []
      }
      if (fileIds.length > 100) {
        throw new Error('Too many file IDs requested (max 100)')
      }

      const db = getDatabase()
      const placeholders = fileIds.map(() => '?').join(',')
      const sql = `SELECT id, kb_id, filename, mime_type, file_size, chunk_count, total_chunks, status, created_at FROM kb_file WHERE kb_id = ? AND id IN (${placeholders})`
      const rs = await db.execute({
        sql,
        args: [kbId, ...fileIds],
      })
      return rs.rows.map((row) => ({
        id: row.id,
        kbId: row.kb_id,
        filename: row.filename,
        mimeType: row.mime_type,
        fileSize: row.file_size || 0,
        chunkCount: row.chunk_count || 0,
        totalChunks: row.total_chunks || 0,
        status: row.status,

View on GitHub (pinned to 81571269ad)

Solutions

  1. Read the message: if it is the server's `error` string (e.g. 'license_key_not_found'), surface it directly; if it is the generic 'failed with status N', inspect N (404 → wrong apiOrigin, 429 → rate limit, 5xx → transient).
  2. Verify the license key matches the product (Pro vs Lite) and is not already activated on the max number of devices (deactivate elsewhere first).
  3. Confirm `apiOrigin` (when overridden) points at the real Chatbox license API; leave it unset to use the default `https://api.chatboxai.app`.
  4. For transient 5xx, retry the activate/validate call with backoff; for 4xx licensing errors, do not retry — prompt the user.

Example fix

// before
await activateNativeLicense(key, instanceName)

// after
try {
  const r = await activateNativeLicense(key, instanceName)
  if (!r.valid) showLicenseError(r.error || 'Invalid license')
} catch (e) {
  if (/status 5\d\d$/.test((e as Error).message)) await retryWithBackoff(() => activateNativeLicense(key, instanceName))
  else showLicenseError((e as Error).message)
}
Defensive patterns

Strategy: try-catch

Validate before calling

function isTransientLicenseError(e: unknown): boolean {
  return e instanceof Error && /status 5\d\d$/.test(e.message)
}

Type guard

function isLicenseError(e: unknown): e is Error {
  return e instanceof Error && (e.message.includes('License request failed') || /license/i.test(e.message))
}

Try / catch

try {
  return await activateNativeLicense(key, instanceName)
} catch (e) {
  if (isTransientLicenseError(e)) return await retryWithBackoff(() => activateNativeLicense(key, instanceName))
  showLicenseError((e as Error).message)
  throw e
}

Prevention

When it happens

Trigger: License key is invalid/already-activated/expired (server returns 4xx with `{ error: '...' }`); instance limit reached for the key; license server unreachable but a proxy returned a non-2xx; apiOrigin misconfigured (wrong Chatbox API host) hitting a 404; rate-limited by the license endpoint; revoked license returns a structured error.

Common situations: User pastes a typo'd license key; key activated on too many devices; license expired; self-hosted/custom apiOrigin set incorrectly; corporate proxy blocks api.chatboxai.app and returns its own error JSON; validate called with an instanceId from a different key.

Related errors


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