Skip to content

[Bug]: DeepSeek custom endpoint returns 400 when uploading PDF files ("file must have a file_id or file_data") #16235

Description

@Learn-Implement

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:

  1. Use OCR to extract text from the PDF and send it as a text message, or
  2. Clearly reject the upload with a user-facing message explaining DeepSeek does not support direct PDF uploads.

Actual behaviour: The PDF is forwarded as a file block in the chat completion request. DeepSeek's Files API only accepts image formats (JPEG, PNG, GIF, WebP) and requires either a file_id (from an upload to https://api.deepseek.com/files) or file_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

  1. Start a new conversation with the DeepSeek custom endpoint (deepseek-flash selected).

  2. Upload any PDF file using the attachment button.

  3. Ask a question about the file.

  4. 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_data

Screenshots

Image

Code of Conduct

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions