chatboxai/chatbox · error · Error

third_party_parser_failed

Error message

third_party_parser_failed

What it means

Thrown in the 'mineru' catch block when parseFileWithMineruService rejects with an error whose message is NOT EMPTY_ATTACHMENT_CONTENT_ERROR and does NOT start with 'third_party_parser'. It is the generic MinerU failure bucket: network errors, HTTP 5xx, malformed MinerU responses, plugin exceptions, etc. The original error is logged via log.error first.

Source

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

          break
        }

        case 'mineru': {
          const apiToken = parserConfig.mineru?.apiToken
          if (!apiToken) {
            throw new Error('mineru_api_token_required')
          }
          try {
            result = await parseFileWithMineruService(file, uniqKey, apiToken)
          } catch (error) {
            log.error(`MinerU parsing failed for "${file.name}":`, error)
            if (
              error instanceof Error &&
              (error.message === EMPTY_ATTACHMENT_CONTENT_ERROR || error.message.startsWith('third_party_parser'))
            ) {
              throw error
            }
            throw new Error('third_party_parser_failed')
          }
          break
        }

        default: {
          throw new Error('document_parser_not_configured')
        }
      }
    }

    stage = 'content_analysis'
    const stats = getContentStats(result.content)
    const sessionAttachmentWarningReason = isParsedContentVeryLarge(stats)
      ? SESSION_ATTACHMENT_RAG_LARGE_ATTACHMENT_WARNING
      : undefined
    if (sessionAttachmentWarningReason) {
      log.info(
        `${SESSION_ATTACHMENT_RAG_LOG_PREFIX} Parsed content is very large: file="${file.name}", parser=${result.parserType}, bytes=${stats.byteLength}, limit=${SESSION_ATTACHMENT_RAG_MAX_PARSED_BYTE_LENGTH}`

View on GitHub (pinned to 81571269ad)

Solutions

  1. Check the renderer log line 'MinerU parsing failed for "<file>":' — it carries the original error; remediate the root cause (renew token, fix network, restart MinerU service).
  2. Retry the attachment once for transient network/5xx failures; MinerU jobs are idempotent per file.
  3. If the MinerU service is unavailable, switch the parser to 'local' or 'chatbox-ai' temporarily.
  4. Improve error fidelity by extending the passthrough check (e.g. also forward auth/quota errors with their own codes) so users see the actual cause instead of the generic bucket.

Example fix

// before
} catch (error) {
  log.error(`MinerU parsing failed for "${file.name}":`, error)
  if (error instanceof Error &&
      (error.message === EMPTY_ATTACHMENT_CONTENT_ERROR ||
       error.message.startsWith('third_party_parser'))) {
    throw error
  }
  throw new Error('third_party_parser_failed')
}
// after — preserve statusCode-bearing errors for the UI
} catch (error) {
  log.error(`MinerU parsing failed for "${file.name}":`, error)
  if (error instanceof ApiError) throw error
  if (error instanceof Error &&
      (error.message === EMPTY_ATTACHMENT_CONTENT_ERROR ||
       error.message.startsWith('third_party_parser'))) {
    throw error
  }
  throw new Error('third_party_parser_failed')
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: validate MinerU reachability with a cheap call before parsing a real file.
async function mineruReachable(apiToken: string): Promise<boolean> {
  try { await platform.parseFileWithMineru!.healthCheck(apiToken); return true }
  catch { return false }
}

Type guard

function isThirdPartyParserFailed(e: unknown): boolean {
  return e instanceof Error && e.message === 'third_party_parser_failed'
}

Try / catch

try {
  await preprocessFile(file)
} catch (e) {
  if (e instanceof Error && e.message === 'third_party_parser_failed') {
    // check the renderer log for the wrapped cause; offer to switch parser
    offerSwitchParser()
    return
  }
  throw e
}

Prevention

When it happens

Trigger: parseFileWithMineruService throws something other than the two passthrough categories — e.g. a fetch rejection, a timeout, an unhandled exception inside platform.parseFileWithMineru, or a non-Error thrown value. The rethrow guard checks error.message prefix; anything else is collapsed into 'third_party_parser_failed'.

Common situations: MinerU API token expired/revoked (auth error); MinerU service down or returning 5xx; network proxy blocking the MinerU endpoint; desktop plugin crashed mid-parse; rate limited; the platform bridge threw an opaque Error whose message doesn't match the passthrough patterns.

Related errors


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