Skip to content

langModelServer silently drops PDF/document blocks from inbound Anthropic requests #325672

Closed

Description

@bhavyaus

langModelServer exposes an Anthropic-compatible /v1/messages endpoint (langModelServer.ts:49), and AnthropicAdapter.parseRequest converts the inbound body via anthropicMessagesToRawMessages (anthropicAdapter.ts:42).

That converter handles text, image, thinking, redacted_thinking, tool_use, and tool_result. Anthropic document blocks (e.g. base64 PDFs) fall into the catch-all branch in anthropicMessageConverter.ts:

} else {
    // thinking or unsupported types are ignored
}

Inside tool_result content, only text and image are mapped, so document is dropped there too.

Impact: an external agent that POSTs a PDF as a document block gets no error and no warning — the PDF is discarded before the model sees it, and the model answers as if the document was never attached. Silent data loss.

Notes:

  • Pre-existing; not introduced by Fix BYOK Anthropic endpoints sending PDFs as image blocks #324960 (that PR fixes the outbound converter, apiMessageToAnthropicMessage).
    - The BYOK provider path is unaffected: it sends convertedMessages directly to Anthropic and only uses the reverse converter for logging (anthropicProvider.ts:130).

Surfaced while reviewing #324960.

Activity

  1. added
    bug
    on Jul 13, 2026
  2. added
    unreleased
    on Jul 27, 2026
  3. added this to the 1.132.0 milestone on Jul 27, 2026
  4. added
    insiders-released
    and removed
    unreleased
    on Jul 28, 2026
  5. added
    verification-steps-needed
    on Aug 3, 2026
  6. jruales commented on Aug 3, 2026

    @jruales
    Contributor

    Bhavya U (@bhavyaus) how do I do this? "an external agent that POSTs a PDF as a document block"

  7. bhavyaus commented on Aug 3, 2026

    @bhavyaus
    CollaboratorAuthor

    Joaquín Ruales (@jruales) with a BYOK anthropic model, attach a PDF and ask it questions related to the PDF. Previously, the model would fail to see the pdf

  8. jruales commented on Aug 3, 2026

    @jruales
    Contributor

    The description above says "The BYOK provider path is unaffected", so shouldn't it be the non-BYOK version to be tested?

  9. bhavyaus commented on Aug 3, 2026

    @bhavyaus
    CollaboratorAuthor

    Fixed. Please ignore the notes.

  10. added
    author-verification-requested
    and removed
    verification-steps-needed
    on Aug 3, 2026
  11. vs-code-engineering commented on Aug 3, 2026

    @vs-code-engineering
    Contributor

    This bug has been fixed in the latest release of VS Code Insiders!

    Bhavya U (@bhavyaus), you can help us out by commenting /verified if things are now working as expected.

    If things still don't seem right, please ensure you're on version 5918810 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.

    Happy Coding!

  12. bhavyaus commented on Aug 4, 2026

    @bhavyaus
    CollaboratorAuthor

    /verified

  13. added
    verified
    and removed
    author-verification-requested
    on Aug 4, 2026
  14. locked and limited conversation to collaborators on Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginsiders-releasedverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions