#16472·LibreChat

[Bug]: Upload to Provider sends archives, Office files and some text types as file parts the provider rejects (400 on every later turn)

Author: mihidumhCreated Sep 28, 2026Updated Sep 30, 2026

What happened?

With "Upload to Provider", some files on the built-in supportedMimeTypes list go to the provider as file parts that the provider always rejects. The provider answers 400. The file stays in the history, so every later turn of the conversation fails the same way.

Measured through a LiteLLM proxy, with an OpenAI file part and data:<mime>;base64,...:

Model behind the gateway 400 200
Azure OpenAI (gpt-5-mini) application/sql, application/x-sh, application/xml, application/zip, application/octet-stream text/plain, text/csv, text/markdown, text/html, text/x-python, application/json, application/yaml, application/typescript, docx
Gemini on Vertex AI (gemini-flash-lite-latest) docx, xlsx, application/sql, application/json, application/yaml, application/xml, application/typescript text/plain, text/csv, text/markdown, text/html, text/x-python

Azure's error: Invalid file data: 'messages[0].content[1].file.file_data'. Expected a base64-encoded data URL with a supported file MIME type, for example 'data:application/pdf;base64,...'. Vertex's error: Unable to submit request because it has a mimeType parameter with value application/vnd.openxmlformats-officedocument.wordprocessingml.document, which is not supported.

The file picker's accept is images and PDF, but "All files" in the OS dialog bypasses it, and drag-and-drop accepts the file too.

Cause. An endpoint with no supportedMimeTypes of its own inherits the built-in list (mergeWithDefault). That list also serves Code Environment and File Search, so it includes zip, tar, sql, sh, json, yaml, docx/xlsx/pptx and epub. The document branch of processAttachments (api/app/clients/BaseClient.js) and of the child-run encoder (packages/api/src/agents/files/encode.ts) accept any file on that list. #13550 made this deliberate for OpenAI, so CSV and XLSX reach the Responses API (#13547). But some types on the list can never go inline:

  • archives (zip, tar, gzip, epub, octet-stream), on every provider;
  • Office documents on Gemini, native or behind a gateway (the Anthropic side already has this filter, from #14535);
  • application/sql, x-sh and xml on Azure OpenAI, and every textual application/* type on Gemini.

The encoder already knows "Claude behind a gateway" by the model name (#14650, #16055). Gemini has no such branch.

Suggested fix. Keep the inherited list as the provider opt-in (#13550). Skip archives unless the endpoint lists them itself. Filter Gemini to PDF and text, as #14535 does for Claude. Send the textual types above as a text part (File: "<name>"\n\n<contents>), unless the endpoint lists them. PR to follow.

Version Information

  • Image registry.librechat.ai/danny-avila/librechat:v0.8.8-rc3. The code is unchanged in v0.8.8-rc4 and on dev (c8c5478cf).
  • Custom OpenAI-compatible endpoints pointed at a LiteLLM proxy, fileConfig.legacyFileUploadUX: true, no supportedMimeTypes on the endpoint.

Steps to Reproduce

  1. Configure a custom endpoint for Azure OpenAI (or Gemini) through an OpenAI-compatible gateway. Do not set supportedMimeTypes on it.
  2. Pick "Upload to Provider", choose "All files" in the OS dialog, and attach query.sql (Gemini: report.docx).
  3. Send a message. The provider returns 400.
  4. Send another message. It fails again, because the file is re-sent from history.

What browsers are you seeing the problem on?

No response

Relevant log output

No response

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct