Skip to content

fix(web): reset TextDecoder after a streaming decode error - #37258

Open
hari714 wants to merge 1 commit into
denoland:mainfrom
hari714:fix/text-decoder-reset
Open

hari714 wants to merge 1 commit into
denoland:mainfrom
hari714:fix/text-decoder-reset

Conversation

@hari714

@hari714 hari714 commented Dec 1, 2026

Copy link
Copy Markdown

Fixes #37209.

After a fatal streaming decode error, TextDecoder retains state from the failed stream. This change clears the decoder handle and rethrows the original error so the next call starts fresh.

The regression test reuses the decoder after the error and checks that it skips a leading byte-order mark. I reproduced the issue on Deno 2.9.8 and ran all 28 tests in tests/unit/text_encoding_test.ts on the patched macOS arm64 build. All passed.

AI disclosure: I used OpenAI Codex (ChatGPT) to investigate the issue.

@CLAassistant

CLAassistant commented Dec 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

Small TextDecoder decode() change

2 participants