{"record":{"id":"db6e2e564101141c","repo":"danny-avila/LibreChat","slug":"file-type-file-mimetype-is-not-supported-for-te","errorCode":null,"errorMessage":"File type ${file.mimetype} is not supported for text parsing.","messagePattern":"File type (.+?) is not supported for text parsing\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"api/server/services/Files/process.js","lineNumber":881,"sourceCode":"\n    const shouldUseSTT = fileConfig.checkType(\n      file.mimetype,\n      fileConfig.stt?.supportedMimeTypes || [],\n    );\n\n    if (shouldUseSTT) {\n      const sttService = await STTService.getInstance();\n      const { text, bytes } = await processAudioFile({ req, file, sttService });\n      return await createTextFile({ text, bytes });\n    }\n\n    const shouldUseText = fileConfig.checkType(\n      file.mimetype,\n      fileConfig.text?.supportedMimeTypes || [],\n    );\n\n    if (!shouldUseText) {\n      throw new Error(`File type ${file.mimetype} is not supported for text parsing.`);\n    }\n\n    /**\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        );","sourceCodeStart":863,"sourceCodeEnd":899,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Files/process.js#L863-L899","documentation":"Thrown at the end of the MIME-type routing chain when the uploaded file's MIME matches none of: OCR-supported, STT-supported, or text-supported MIME lists (and `shouldUseConfiguredText` is false). The server has no configured handler for that MIME type, so it refuses text extraction rather than guessing.","triggerScenarios":"A file whose MIME is not in any of the admin-configured `supportedMimeTypes` arrays for OCR, STT, or text — e.g., a `.zip`, `.exe`, `.csv` not enabled for text, or an unusual MIME like `application/x-foo`. Also a real document type the admin simply didn't whitelist.","commonSituations":"Admin enabled PDF/DOCX but not TXT/CSV/MD; user uploads a binary archive expecting extraction; MIME sniffed incorrectly so a supported type is misclassified; a new file type not yet in the config.","solutions":["Add the MIME type to the appropriate `supportedMimeTypes` array in fileConfig (text/OCR/STT) via admin settings.","Upload a supported format instead (convert the file to PDF/DOCX/TXT).","Verify the actual MIME with `file --mime-type` — Multer may have sniffed from extension and gotten it wrong.","If the type should never be parsed, suppress the upload affordance in the UI for that type."],"exampleFix":"// config: enable CSV and Markdown text extraction\nfileConfig: {\n  text: { supportedMimeTypes: [\n    'text/plain', 'text/markdown', 'text/csv',\n    'application/pdf', 'application/vnd.openxmlformats...'\n  ] }\n}","handlingStrategy":"validation","validationCode":"function isSupportedMime(file, fileConfig) {\n  const lists = [\n    fileConfig.ocr?.supportedMimeTypes || [],\n    fileConfig.stt?.supportedMimeTypes || [],\n    fileConfig.text?.supportedMimeTypes || [],\n  ];\n  return lists.some(l => l.includes(file.mimetype));\n}","typeGuard":null,"tryCatchPattern":"try { await processAgentFileUpload(params); }\ncatch (e) {\n  if (/is not supported for text parsing/.test(e.message)) return res.status(415).json({ error: e.message });\n  throw e;\n}","preventionTips":["Keep the `supportedMimeTypes` arrays in fileConfig aligned with what users actually upload.","Verify MIME with `file --mime-type`; Multer sniffs from extension and can misclassify.","Hide the upload affordance for unsupported file types in the UI."],"tags":["mime-type","file-config","text-extraction","validation"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}