danny-avila/LibreChat · warning · Error

Unable to extract text from "${file.originalname}". RAG text

Error message

Unable to extract text from "${file.originalname}". RAG text extraction was unavailable and the built-in parser produced no result.

What it means

Thrown when `shouldUseConfiguredText` is true, `parseText` (RAG `/text` endpoint with `allowNativeFallback: false`) threw, AND the fallback built-in document parser (`resolveDocumentText`) returned null. Both extraction paths failed: RAG was unreachable/errored, and the local parser produced no text. The user-facing message names both failures.

Source

Thrown at api/server/services/Files/process.js:902

    /**
     * A document type the admin routed to configured text extraction: prefer RAG `/text`, but fall
     * back to the built-in document parser (not raw native text) when RAG is unavailable, so a
     * transient outage doesn't degrade a docx/pdf to unreadable bytes. Only the RAG extraction is
     * inside the fallback catch: a downstream persistence failure (size guard, DB, agent-resource
     * mutation) must surface as itself, not trigger a second extraction attempt.
     */
    if (shouldUseConfiguredText) {
      let configuredText;
      try {
        configuredText = await parseText({ req, file, file_id, allowNativeFallback: false });
      } catch (err) {
        logger.warn(
          `[processAgentFileUpload] Configured RAG text extraction unavailable for "${file.originalname}", using built-in document parser:`,
          err,
        );
        const documentText = await resolveDocumentText();
        if (!documentText) {
          throw new Error(
            `Unable to extract text from "${file.originalname}". RAG text extraction was unavailable and the built-in parser produced no result.`,
          );
        }
        const { text, bytes, filepath: docFileURL } = documentText;
        return await createTextFile({ text, bytes, filepath: docFileURL });
      }
      return await createTextFile({
        text: configuredText.text,
        bytes: configuredText.bytes,
        type: file.mimetype,
      });
    }

    const { text, bytes } = await parseText({ req, file, file_id });
    return await createTextFile({ text, bytes, type: file.mimetype });
  }

  // Dual storage pattern for RAG files: Storage + Vector DB

View on GitHub (pinned to 5ff282f900)

Solutions

  1. Check server logs for the `[processAgentFileUpload] Configured RAG text extraction unavailable` warn — it contains the RAG error.
  2. Verify RAG service health and the configured endpoint/URL.
  3. Re-test with a known-good document; if it also fails, the RAG integration itself is broken.
  4. If RAG is reliably unavailable, consider disabling `shouldUseConfiguredText` for that MIME so the built-in parser is the primary path.
Defensive patterns

Strategy: fallback

Try / catch

try { await processAgentFileUpload(params); }
catch (e) {
  if (/RAG text extraction was unavailable/.test(e.message)) {
    logger.error('Both RAG and built-in parser failed', { raw: e.message });
    return res.status(503).json({ error: 'Text extraction temporarily unavailable; please retry later.' });
  }
  throw e;
}

Prevention

When it happens

Trigger: A document configured for RAG text extraction where the RAG service is down or errored (parseText rejects), and the built-in document parser either does not handle the format or also errors silently and returns nothing. The catch around parseText logs a warn and falls through; the null check on resolveDocumentText is what throws here.

Common situations: RAG service outage or misconfigured endpoint; RAG rejecting the document (too large for RAG's own limits); a corrupt source document both pipelines cannot parse; RAG credentials invalid causing parseText to throw.

Related errors


AI-assisted analysis of danny-avila/LibreChat@5ff282f900 (2026-08-12). Data as JSON: /api/errors/22efb5fc59d49e88. Report an issue: GitHub.