chatboxai/chatbox · error · Error
Invalid pagination parameters
Error message
Invalid pagination parameters
What it means
Thrown by authenticatedAfetch for any non-2xx, non-401 response on the first attempt (the 401 branch is handled separately above). Identical construction to the unauthenticated afetch ApiError (status + sanitised body + responseBody + statusCode + requestId), but emitted from the authenticated wrapper. This is the catch-all HTTP error for authenticated requests that are not auth-related.
Source
Thrown at src/main/knowledge-base/ipc-handlers.ts:332
sentry.withScope((scope) => {
scope.setTag('component', 'knowledge-base-ipc')
scope.setTag('operation', 'file_count')
scope.setExtra('kbId', kbId)
sentry.captureException(error)
})
throw error
}
})
ipcMain.handle('kb:file:list-paginated', async (_event, kbId: number, offset = 0, limit = 20) => {
try {
// log.debug(`ipcMain: kb:file:list-paginated, kbId=${kbId}, offset=${offset}, limit=${limit}`)
if (!kbId || kbId <= 0) {
throw new Error('Invalid knowledge base ID')
}
if (offset < 0 || limit <= 0 || limit > 100) {
throw new Error('Invalid pagination parameters')
}
const db = getDatabase()
const rs = await db.execute({
sql: 'SELECT * FROM kb_file WHERE kb_id = ? ORDER BY created_at DESC LIMIT ? OFFSET ?',
args: [kbId, limit, offset],
})
return rs.rows.map((row) => ({
id: row.id,
kb_id: row.kb_id,
filename: row.filename,
filepath: row.filepath,
mime_type: row.mime_type,
file_size: row.file_size || 0,
chunk_count: row.chunk_count || 0,
total_chunks: row.total_chunks || 0,
status: row.status,
error: row.error,View on GitHub (pinned to 81571269ad)
Solutions
- Read `error.statusCode`: 403 → entitlement/plan issue, 429 → slow down or surface the quota UI, 4xx other → fix the request payload, 5xx → transient retry.
- If `options.parseChatboxRemoteError` was enabled and you still got a raw ApiError, the backend error code is not in ChatboxAIAPIError.codeNameMap — report it so it gets a dedicated i18n key.
- Use `error.requestId` when contacting support / correlating server logs.
- For 5xx, retry with backoff at the caller; for 4xx (except 429), do not retry.
Example fix
// before
const res = await authedAfetch(url, init, { parseChatboxRemoteError: true })
// after
try { const res = await authedAfetch(url, init, { parseChatboxRemoteError: true }) }
catch (e) {
if (e instanceof ChatboxAIAPIError) showI18nError(e.detail.i18nKey)
else if (e instanceof ApiError && e.statusCode === 429) showQuotaUI()
throw e
} Defensive patterns
Strategy: try-catch
Validate before calling
function classifyAuthedError(e: ApiError): 'auth' | 'quota' | 'client' | 'server' {
if (e.statusCode === 401 || e.statusCode === 403) return 'auth'
if (e.statusCode === 429) return 'quota'
if (e.statusCode && e.statusCode >= 500) return 'server'
return 'client'
} Type guard
import { ApiError, ChatboxAIAPIError } from '../models/errors'
function isApiError(e: unknown): e is ApiError { return e instanceof ApiError } Try / catch
try { return await authedAfetch(url, init, { parseChatboxRemoteError: true }) }
catch (e) {
if (e instanceof ChatboxAIAPIError) showI18nError(e.detail.i18nKey)
else if (e instanceof ApiError && e.statusCode === 429) showQuotaUI()
else if (e instanceof ApiError && e.statusCode && e.statusCode >= 500) await backoff()
throw e
} Prevention
- Always pass parseChatboxRemoteError: true for Chatbox AI endpoints so known codes get i18n messages.
- Map new backend codes into ChatboxAIAPIError.codeNameMap so they stop reaching this generic throw.
- Use requestId when filing support tickets.
When it happens
Trigger: Authenticated request returns 400 (bad params), 403 (forbidden — permissions/feature not entitled), 404 (endpoint/resource missing), 429 (rate limit / quota exhausted on Chatbox AI), 5xx (Chatbox AI backend error, gateway HTML). The Chatbox-remote-error parser runs first and may convert known codes into a ChatboxAIAPIError; only unmapped errors reach this throw.
Common situations: Chatbox AI quota exhausted but the error code is not in the codeNameMap; feature not entitled for the user's plan (403); malformed request body (400); backend outage (502/503 HTML, sanitised); deprecated endpoint returning 404 after an API revision; rate limiting on bursty agent loops.
Related errors
- Knowledge base name cannot be empty
- Knowledge base ${kbId} not found
- Too many file IDs requested (max 100)
- VibeDrop authorization failed
- OCR Error (${ocrProvider}): ${cause.message}
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/2a9527a77fb5f72f.
Report an issue: GitHub.