You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
attachments: large PDF returns HTTP 500 during Prompt.Base64 validation #57116
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.
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.
Activity
opencode-agent commentedon Oct 19, 2026
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.Base64check inpackages/schema/src/prompt.tsuses the repeated-group regex you quoted. In the Bun runtime that ships with OpenCode, it silently returnsfalsefor valid base64 once the string is longer than a few MB. That shows up asInvalidValuerather 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 ondevyet, and a fix is proposed in PR #51272, which hasn't been merged.Possible duplicates and related issues, ordered by likelihood:
Prompt.Base64500 onPOST /api/session/<id>/promptfromnormalizeImageAttachment, with the root-cause analysis and reports on many 2.0.x versionsUntil 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.
opencode-agent commentedon Oct 20, 2026
Closing this as a duplicate of #45558, since there was no reply saying how it's different. It's the same
Prompt.Base64validation 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.