{"record":{"id":"948911764ed35a8e","repo":"chatboxai/chatbox","slug":"local-parser-failed","errorCode":null,"errorMessage":"local_parser_failed","messagePattern":"local_parser_failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/renderer/stores/sessionHelpers.ts","lineNumber":361,"sourceCode":"    `${SESSION_ATTACHMENT_RAG_LOG_PREFIX} Capability fetched: embedding=${value}, hasLicense=${Boolean(licenseKey)}, platform=${platform.type}`\n  )\n  sessionRagCapabilityCache = { key: capabilityCacheKey, value }\n  return value\n}\n\n/**\n * Parse file using local parser\n */\nasync function parseFileWithLocalParser(\n  file: File,\n  uniqKey: string\n): Promise<{ content: string; storageKey: string; tokenCountMap: Record<string, number>; parserType: string }> {\n  const result = await platform.parseFileLocally(file)\n\n  if (!result.isSupported || !result.key) {\n    // Preserve a specific parser error code (password-protected / too large) so the\n    // UI can explain it; otherwise fall back to the generic failure.\n    throw new Error(result.errorCode || 'local_parser_failed')\n  }\n\n  // Get content from temporary storage\n  const content = (await storage.getBlob(result.key).catch(() => '')) || ''\n\n  // Store content to unique key\n  if (content) {\n    await storage.setBlob(uniqKey, content)\n  }\n\n  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 }> {","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/stores/sessionHelpers.ts#L343-L379","documentation":"Generic local-parser failure thrown by parseFileWithLocalParser. platform.parseFileLocally(file) returned isSupported=false (or no key) and supplied no specific errorCode, so the helper falls back to the catch-all 'local_parser_failed'. Specific recoverable codes (password-protected, too large) are preserved when present.","triggerScenarios":"The desktop main-process parser (src/main/file-parser.ts) cannot handle the file: unsupported format, parser crash, missing native dependency, or a generic exception with no errorCode. The result object's isSupported is false and errorCode is empty.","commonSituations":"User attaches an unsupported file type, the local parser's native binary is missing on the current platform, pdfjs failed to load, or a corrupt file triggered an uncaught error in the parser.","solutions":["Inspect result.errorCode before falling back to surface password-protected/too-large reasons accurately.","Enable Chatbox AI cloud fallback (shouldFallbackToChatboxAI) so unsupported-but-recoverable files retry remotely.","Ensure the desktop parser native deps are bundled for the user's platform.","Log file extension/size with the failure to identify unsupported-format clusters."],"exampleFix":"// before\nif (!result.isSupported || !result.key) {\n  throw new Error(result.errorCode || 'local_parser_failed')\n}\n// after\nif (!result.isSupported || !result.key) {\n  throw new Error(result.errorCode || 'local_parser_failed')\n}","handlingStrategy":"fallback","validationCode":"const result = await platform.parseFileLocally(file)\nif (!result.isSupported || !result.key) {\n  // result.errorCode may carry a specific reason (pdf_password_protected, local_parser_file_too_large)\n}","typeGuard":"function isLocalParseSuccess(r: { isSupported: boolean; key?: string | null }): r is { isSupported: true; key: string } {\n  return r.isSupported === true && typeof r.key === 'string' && r.key.length > 0\n}","tryCatchPattern":"try {\n  return await parseFileWithLocalParser(file, uniqKey)\n} catch (err) {\n  if (shouldFallbackToChatboxAI(options)) return await fallbackToChatboxAIParser(file, uniqKey, 'local_parser_failed')\n  throw err\n}","preventionTips":["Inspect result.errorCode to surface specific reasons before the generic fallback.","Enable cloud fallback for recoverable unsupported formats.","Bundle native parser deps for the target platform."],"tags":["file-parsing","local-parser","attachments","desktop"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}