chatboxai/chatbox · warning · Error

local_parser_failed

Error message

local_parser_failed

What it means

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.

Source

Thrown at src/renderer/stores/sessionHelpers.ts:361

    `${SESSION_ATTACHMENT_RAG_LOG_PREFIX} Capability fetched: embedding=${value}, hasLicense=${Boolean(licenseKey)}, platform=${platform.type}`
  )
  sessionRagCapabilityCache = { key: capabilityCacheKey, value }
  return value
}

/**
 * Parse file using local parser
 */
async function parseFileWithLocalParser(
  file: File,
  uniqKey: string
): Promise<{ content: string; storageKey: string; tokenCountMap: Record<string, number>; parserType: string }> {
  const result = await platform.parseFileLocally(file)

  if (!result.isSupported || !result.key) {
    // Preserve a specific parser error code (password-protected / too large) so the
    // UI can explain it; otherwise fall back to the generic failure.
    throw new Error(result.errorCode || 'local_parser_failed')
  }

  // Get content from temporary storage
  const content = (await storage.getBlob(result.key).catch(() => '')) || ''

  // Store content to unique key
  if (content) {
    await storage.setBlob(uniqKey, content)
  }

  return { content, storageKey: uniqKey, tokenCountMap: {}, parserType: 'local' }
}

async function fallbackToChatboxAIParser(
  file: File,
  uniqKey: string,
  reason: 'local_parser_failed' | 'empty_content'
): Promise<{ content: string; storageKey: string; tokenCountMap: Record<string, number>; parserType: string }> {

View on GitHub (pinned to 81571269ad)

Solutions

  1. Inspect result.errorCode before falling back to surface password-protected/too-large reasons accurately.
  2. Enable Chatbox AI cloud fallback (shouldFallbackToChatboxAI) so unsupported-but-recoverable files retry remotely.
  3. Ensure the desktop parser native deps are bundled for the user's platform.
  4. Log file extension/size with the failure to identify unsupported-format clusters.

Example fix

// before
if (!result.isSupported || !result.key) {
  throw new Error(result.errorCode || 'local_parser_failed')
}
// after
if (!result.isSupported || !result.key) {
  throw new Error(result.errorCode || 'local_parser_failed')
}
Defensive patterns

Strategy: fallback

Validate before calling

const result = await platform.parseFileLocally(file)
if (!result.isSupported || !result.key) {
  // result.errorCode may carry a specific reason (pdf_password_protected, local_parser_file_too_large)
}

Type guard

function isLocalParseSuccess(r: { isSupported: boolean; key?: string | null }): r is { isSupported: true; key: string } {
  return r.isSupported === true && typeof r.key === 'string' && r.key.length > 0
}

Try / catch

try {
  return await parseFileWithLocalParser(file, uniqKey)
} catch (err) {
  if (shouldFallbackToChatboxAI(options)) return await fallbackToChatboxAIParser(file, uniqKey, 'local_parser_failed')
  throw err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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