chatboxai/chatbox · error · Error
Backup JSON entry is too large: ${path}
Error message
Backup JSON entry is too large: ${path} What it means
Thrown by jsonEntry() during backup export when a single JSON value (serialized via JSON.stringify + TextEncoder.encode) exceeds MAX_BACKUP_JSON_ENTRY_BYTES (128 MiB). This is the per-entry guard for structured JSON archive members (settings, session metadata, message lists) before they enter the zip stream. It prevents a single pathological blob from exhausting memory during compression.
Source
Thrown at src/renderer/packages/backup/export-backup.ts:98
name: session.name,
starred: session.starred,
hidden: session.hidden,
archivedAt: session.archivedAt,
assistantAvatarKey: session.assistantAvatarKey,
picUrl: session.picUrl,
backgroundImage: session.backgroundImage,
type: session.type,
sortOrder: existing?.sortOrder ?? Date.now(),
createdAt: existing?.createdAt ?? Date.now(),
}
}
async function jsonEntry(
path: string,
value: unknown
): Promise<{ archive: ZipArchiveEntry; descriptor: BackupJsonEntry }> {
const bytes = new TextEncoder().encode(JSON.stringify(value))
if (bytes.length > MAX_BACKUP_JSON_ENTRY_BYTES) throw new Error(`Backup JSON entry is too large: ${path}`)
return {
archive: { path, data: bytes, compress: true },
descriptor: { path, size: bytes.length, checksum: await sha256Checksum(bytes) },
}
}
async function* enforceArchiveLimits(
entries: AsyncIterable<ZipArchiveEntry>
): AsyncGenerator<ZipArchiveEntry, void, unknown> {
let entryCount = 0
let totalUncompressedBytes = 0
for await (const entry of entries) {
entryCount++
if (entryCount > DEFAULT_ZIP_LIMITS.maxEntries) throw new Error('Backup contains too many entries')
const maxEntryBytes = backupEntryByteLimit(entry.path)
if (entry.data instanceof Uint8Array) {
if (entry.data.length > maxEntryBytes) throw new Error(`Backup entry is too large: ${entry.path}`)
totalUncompressedBytes += entry.data.lengthView on GitHub (pinned to 81571269ad)
Solutions
- Identify which entry (path) exceeds the limit and split the session into smaller conversations before exporting.
- Prune very large messages or attachments from the session before backup.
- If the entry is legitimately large (e.g. a giant settings blob), raise MAX_BACKUP_JSON_ENTRY_BYTES with awareness of memory impact.
- Export a subset of sessions (not 'all conversations') to isolate the oversized one.
Example fix
// before
const bytes = new TextEncoder().encode(JSON.stringify(value))
if (bytes.length > MAX_BACKUP_JSON_ENTRY_BYTES) throw new Error(`Backup JSON entry is too large: ${path}`)
// after — report the size so the user can act
const bytes = new TextEncoder().encode(JSON.stringify(value))
if (bytes.length > MAX_BACKUP_JSON_ENTRY_BYTES) {
const mb = Math.round(bytes.length / (1024 * 1024))
throw new Error(`Backup JSON entry is too large: ${path} (${mb} MiB > ${MAX_BACKUP_JSON_ENTRY_BYTES / (1024 * 1024)} MiB limit). Split or prune this entry.`)
} Defensive patterns
Strategy: validation
Validate before calling
const MAX_BACKUP_JSON_ENTRY_BYTES = 128 * 1024 * 1024
function estimateJsonBytes(value: unknown): number {
// rough estimate without full serialize
return new TextEncoder().encode(JSON.stringify(value)).length
}
if (estimateJsonBytes(session) > MAX_BACKUP_JSON_ENTRY_BYTES) {
throw new Error('Session too large to back up; split it first')
} Try / catch
try {
await exportBackup({ items: ['conversations'] })
} catch (error) {
if (error instanceof Error && /Backup JSON entry is too large/i.test(error.message)) {
showToast('One conversation is too large. Split or prune it, then try again.')
} else throw error
} Prevention
- Split very large sessions into smaller conversations before exporting.
- Prune oversized messages or embedded data from sessions.
- Export subsets of conversations to isolate which entry exceeds the limit.
When it happens
Trigger: A backup export serializes a session or settings object whose JSON encoding exceeds 128 MiB. This requires an extremely large single session (millions of messages) or a settings blob with a huge embedded data structure. The check runs synchronously after encoding, before sha256 and zip entry creation.
Common situations: A single conversation with a very large number of accumulated messages (e.g. an agent loop with thousands of turns and long outputs); a settings object with a massive embedded blob; corrupted/duplicated data inflating one entry. The 128 MiB JSON limit is per-entry; resources (images) use a higher 512 MiB limit via backupEntryByteLimit.
Related errors
- Backup contains too many entries
- Backup entry is too large: ${entry.path}
- Backup uncompressed size exceeds the safety limit
- Managed resource exceeds the backup size limit
- Backup JSON entry is too large: ${path}
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/35c0a283aefe200e.
Report an issue: GitHub.