Skip to content

attachments: large PDF returns HTTP 500 during Prompt.Base64 validation #57116

Closed as duplicate

Activity

  1. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    Thanks for the thorough report and the direct API reproduction. I think this is a duplicate of #45558.

    The 500 doesn't come from your PDF or from a size limit. The Prompt.Base64 check in packages/schema/src/prompt.ts uses the repeated-group regex you quoted. In the Bun runtime that ships with OpenCode, it silently returns false for valid base64 once the string is longer than a few MB. That shows up as InvalidValue rather than the stack overflow you saw in Node. Your 1 MiB and 4 MiB prefixes pass and the full 10 MB file fails, which fits that. The regex hasn't changed on dev yet, and a fix is proposed in PR #51272, which hasn't been merged.

    Possible duplicates and related issues, ordered by likelihood:

    Until it's fixed, the workaround you found still works: let the agent read the PDF from its local path instead of attaching it.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. Please subscribe to #45558 to follow progress.

  2. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #45558, since there was no reply saying how it's different. It's the same Prompt.Base64 validation failure that gives HTTP 500 on attachments over about 5–6 MB, including your 9.67 MiB PDF on 2.0.32. Closing just keeps the discussion in one place; the bug itself is still open. The proposed fix, PR #51272, hasn't been merged yet, so please subscribe to #45558 or #51272 to follow it. Until then, letting the agent read the PDF from its local path still works. If your problem turns out to be different, feel free to reply here.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions