{"record":{"id":"22efb5fc59d49e88","repo":"danny-avila/LibreChat","slug":"unable-to-extract-text-from-file-originalname-22efb5","errorCode":null,"errorMessage":"Unable to extract text from \"${file.originalname}\". RAG text extraction was unavailable and the built-in parser produced no result.","messagePattern":"Unable to extract text from \"(.+?)\"\\. RAG text extraction was unavailable and the built-in parser produced no result\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"api/server/services/Files/process.js","lineNumber":902,"sourceCode":"    /**\n     * A document type the admin routed to configured text extraction: prefer RAG `/text`, but fall\n     * back to the built-in document parser (not raw native text) when RAG is unavailable, so a\n     * transient outage doesn't degrade a docx/pdf to unreadable bytes. Only the RAG extraction is\n     * inside the fallback catch: a downstream persistence failure (size guard, DB, agent-resource\n     * mutation) must surface as itself, not trigger a second extraction attempt.\n     */\n    if (shouldUseConfiguredText) {\n      let configuredText;\n      try {\n        configuredText = await parseText({ req, file, file_id, allowNativeFallback: false });\n      } catch (err) {\n        logger.warn(\n          `[processAgentFileUpload] Configured RAG text extraction unavailable for \"${file.originalname}\", using built-in document parser:`,\n          err,\n        );\n        const documentText = await resolveDocumentText();\n        if (!documentText) {\n          throw new Error(\n            `Unable to extract text from \"${file.originalname}\". RAG text extraction was unavailable and the built-in parser produced no result.`,\n          );\n        }\n        const { text, bytes, filepath: docFileURL } = documentText;\n        return await createTextFile({ text, bytes, filepath: docFileURL });\n      }\n      return await createTextFile({\n        text: configuredText.text,\n        bytes: configuredText.bytes,\n        type: file.mimetype,\n      });\n    }\n\n    const { text, bytes } = await parseText({ req, file, file_id });\n    return await createTextFile({ text, bytes, type: file.mimetype });\n  }\n\n  // Dual storage pattern for RAG files: Storage + Vector DB","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/process.js#L884-L920","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check server logs for the `[processAgentFileUpload] Configured RAG text extraction unavailable` warn — it contains the RAG error.","Verify RAG service health and the configured endpoint/URL.","Re-test with a known-good document; if it also fails, the RAG integration itself is broken.","If RAG is reliably unavailable, consider disabling `shouldUseConfiguredText` for that MIME so the built-in parser is the primary path."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await processAgentFileUpload(params); }\ncatch (e) {\n  if (/RAG text extraction was unavailable/.test(e.message)) {\n    logger.error('Both RAG and built-in parser failed', { raw: e.message });\n    return res.status(503).json({ error: 'Text extraction temporarily unavailable; please retry later.' });\n  }\n  throw e;\n}","preventionTips":["Monitor the RAG service endpoint — this error means it is down or rejecting the doc.","Read the `[processAgentFileUpload] Configured RAG text extraction unavailable` warn for the root cause.","Keep the built-in document parser version current as a reliable fallback."],"tags":["rag","text-extraction","document","fallback"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}