{"record":{"id":"2aa2b95866dc160f","repo":"chatboxai/chatbox","slug":"file-storage-quota-exceeded","errorCode":"file_storage_quota_exceeded","errorMessage":"file_storage_quota_exceeded","messagePattern":"file_storage_quota_exceeded","errorType":"exception","errorClass":"FilePreprocessFailure","httpStatus":null,"severity":"error","filePath":"src/renderer/stores/sessionHelpers.ts","lineNumber":390,"sourceCode":"  return { content, storageKey: uniqKey, tokenCountMap: {}, parserType: 'local' }\n}\n\nasync function fallbackToChatboxAIParser(\n  file: File,\n  uniqKey: string,\n  reason: 'local_parser_failed' | 'empty_content'\n): Promise<{ content: string; storageKey: string; tokenCountMap: Record<string, number>; parserType: string }> {\n  log.warn(`Falling back to Chatbox AI parser for \"${file.name}\" due to ${reason}`)\n\n  try {\n    return await parseFileWithChatboxAI(file, uniqKey)\n  } catch (error) {\n    log.error(`Chatbox AI fallback parsing failed for \"${file.name}\":`, error)\n    // A full client-side storage database is not a cloud-parser problem — persisting the\n    // parsed content fails the same way. Preserve it for the quota-specific user message\n    // and sanitized Sentry report at the outer boundary.\n    if (isStorageQuotaError(error)) {\n      throw new FilePreprocessFailure(FILE_STORAGE_QUOTA_EXCEEDED_ERROR, 'cloud_parse', error)\n    }\n    if (error instanceof Error && error.message === EMPTY_ATTACHMENT_CONTENT_ERROR) {\n      throw error\n    }\n    throw new Error('chatbox_ai_parser_failed')\n  }\n}\n\ntype LocalParserFallbackOptions = {\n  allowChatboxAIFallback?: boolean\n  forceChatboxAIFallback?: boolean\n}\n\nfunction shouldFallbackToChatboxAI(options: LocalParserFallbackOptions): boolean {\n  return (\n    Boolean(options.forceChatboxAIFallback) || (options.allowChatboxAIFallback !== false && canFallbackToChatboxAI())\n  )\n}","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/stores/sessionHelpers.ts#L372-L408","documentation":"FilePreprocessFailure with code file_storage_quota_exceeded, thrown from fallbackToChatboxAIParser when the cloud-parse path caught a storage-quota error. The comment explains that a full client-side database breaks cloud parsing too — persisting the parsed content fails the same way — so the quota error is preserved for an accurate user message and sanitized Sentry report rather than masked as a parser failure.","triggerScenarios":"After local parsing failed, the code falls back to parseFileWithChatboxAI; that path tries to persist the parsed text via IndexedDB/local storage and the write throws a QuotaExceededError (name match or message regex). isStorageQuotaError returns true and the helper wraps it.","commonSituations":"User's browser/Electron storage is full (many large attachments/history), private browsing mode with strict quotas, or a device with very low free space. The cloud parser succeeded but the local persist step failed.","solutions":["Free local storage: clear old attachments/history, evict large blobs.","Raise awareness in the UI with the file_storage_quota_exceeded message and a 'clear history' action.","Quota errors are non-recoverable for cloud fallback too; do not retry — prompt the user to free space.","Consider lazy/on-demand blob storage instead of persisting full parsed content."],"exampleFix":"// before\nif (isStorageQuotaError(error)) {\n  throw new FilePreprocessFailure(FILE_STORAGE_QUOTA_EXCEEDED_ERROR, 'cloud_parse', error)\n}\n// after\nif (isStorageQuotaError(error)) {\n  throw new FilePreprocessFailure(FILE_STORAGE_QUOTA_EXCEEDED_ERROR, 'cloud_parse', error)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isFileStorageQuotaFailure(e: unknown): e is { code: 'file_storage_quota_exceeded'; name: 'FilePreprocessFailure' } {\n  return e instanceof Error && (e as { code?: string }).code === 'file_storage_quota_exceeded'\n}","tryCatchPattern":"try {\n  return await parseFileWithLocalFallback(file, uniqKey, options)\n} catch (err) {\n  if (isFileStorageQuotaFailure(err)) {\n    notifyUser('Local storage is full. Clear old attachments/history and try again.')\n    return null\n  }\n  throw err\n}","preventionTips":["Free local storage before attaching large files.","Do not retry — cloud persist fails identically when storage is full.","Evict large/old blobs proactively."],"tags":["file-parsing","storage-quota","indexeddb","cloud-parser","attachments"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}