Skip to content

Fix "bufio.Scanner token too long" error by replacing Scanner with Reader in SSE - #3531

Merged
rekram1-node merged 2 commits into
anomalyco:devfrom
yudgnahk:fix/fix-bufio-error
Oct 30, 2025
Merged

rekram1-node merged 2 commits into
anomalyco:devfrom
yudgnahk:fix/fix-bufio-error

Conversation

@yudgnahk

Copy link
Copy Markdown
Contributor

Related issues:

Fix bufio.Scanner token too long error in SSE decoder

The SSE stream decoder was hitting a 32MB hard limit when processing large events,
causing bufio.Scanner: token too long errors. This blocked users from reading large
files through the TUI.

Changes:

• Register UnboundedDecoder for the text/event-stream

    ssestream.RegisterDecoder("text/event-stream", decoders.NewUnboundedDecoder)

• Uses ReadBytes('\n') which grows dynamically without size limits
• Added documentation and test files

Testing: Verified with events up to 50MB. All tests pass.

@yudgnahk

Copy link
Copy Markdown
Contributor Author

Hey @rekram1-node, this is my PR.
It's a pleasant if you help me review it.
Thank you!

@yudgnahk

Copy link
Copy Markdown
Contributor Author

Hi @rekram1-node,
Maybe you forgot this PR?...

@rekram1-node

Copy link
Copy Markdown
Collaborator

will take a look, today I got the most github notifications ive ever had so a few things may slip through

I didnt forget about u tho! Just hadnt had a chance to review

@rekram1-node
rekram1-node merged commit 4b5e447 into anomalyco:dev Oct 30, 2025
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants