[Bug]: DeepSeek custom endpoint returns 400 when uploading PDF files ("file must have a file_id or file_data") #16251
Replies: 3 comments
|
Thanks for the report. DeepSeek's documented For new uploads on a build with unified file upload (not v0.8.7), route PDFs through text extraction for the custom endpoint: fileConfig:
endpoints:
YourDeepSeekEndpointName: # match the endpoint's name in librechat.yaml
legacyFileUploadUX: false
defaultLLMDeliveryPath:
overrides:
'application/pdf': textPlease test a new PDF in a new conversation after upgrading. This setting does not repair PDFs already attached under the older routing. If the new test still fails, please provide the exact LibreChat image digest, whether this is a direct chat or saved agent, and a redacted outgoing content-part shape (keys only, no PDF bytes or credentials). Related vLLM/llama.cpp report: #16234. |
|
Update: Confirmed root cause and relevant issues I have tested the DOCX files work correctly with both Images (PNG/JPEG) work correctly with deepseek-flash. PDF files (both text-based and image-containing) fail consistently with the error: This confirms that the This appears to be the same root cause documented in these existing threads: Discussion #10988 – "DeepSeek and Grok (xAI) configuration: File upload, web search limitations, and required workarounds" – explicitly states that for DeepSeek, "only the OCR approach works". Issue #13334 – "[Bug]: Agent with DeepSeek model — 'Upload to Provider' sends unsupported Discussion #6297 – "Inconsistent fileConfig Restrictions for Custom Endpoints" – notes that custom endpoint file restrictions are applied inconsistently between the SidePanel and direct upload. Could you confirm whether the |


Uh oh!
There was an error while loading. Please reload this page.
What happened?
Uploading a PDF file to a conversation using the DeepSeek custom endpoint (deepseek-flash) produces:
400 .messages[1]: file must have a file_id or file_data
This occurs on a brand-new conversation with no prior history. The PDF is small and well under the container's Nginx body limit (client_max_body_size 25M, confirmed inside the container). It is not a request-size issue.
Expected behaviour: LibreChat should either:
Actual behaviour: The PDF is forwarded as a
fileblock in the chat completion request. DeepSeek's Files API only accepts image formats (JPEG, PNG, GIF, WebP) and requires either afile_id(from an upload to https://api.deepseek.com/files) orfile_data(base64-encoded image). A PDF cannot satisfy either requirement, so DeepSeek returns 400.Precedent: Discussion #10988 already documents that DeepSeek requires the OCR workaround for file uploads.
Workaround in use: Switching to Gemini 3.8 Flash for PDF uploads works because Google's API supports PDFs natively.
Version Information
LibreChat v0.8.7
Deployment: Self-hosted Docker Compose (local)
Image: registry.librechat.ai/danny-avila/librechat-dev:latest
Reverse proxy: None (direct port 3080)
Custom endpoints: DeepSeek V4 Pro, DeepSeek Flash, Gemini, Qwen
Redis: redis:7-alpine (docker), USE_REDIS_STREAMS=true
Steps to Reproduce
Start a new conversation with the DeepSeek custom endpoint (deepseek-flash selected).
Upload any PDF file using the attachment button.
Ask a question about the file.
Observe the error:
400 .messages[1]: file must have a file_id or file_data
What browsers are you seeing the problem on?
Firefox, Chrome, Microsoft Edge
Relevant log output
2026-09-23 09:03:13 error: [api/server/controllers/agents/client.js #sendCompletion] Unhandled error type 400 .messages[1]: file must have a file_id or file_dataScreenshots
Code of Conduct
All reactions