Title: fix(client/stdio): default encoding_error_handler to 'replace' for resilient UTF-8 decoding by sarvesh1327 · Pull Request #2907 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix(client/stdio): default encoding_error_handler to 'replace' for resilient UTF-8 decoding by sarvesh1327 · Pull Request #2907 · modelcontextprotocol/python-sdk
X Title: fix(client/stdio): default encoding_error_handler to 'replace' for resilient UTF-8 decoding by sarvesh1327 · Pull Request #2907 · modelcontextprotocol/python-sdk
Description: Summary Changes the default encoding_error_handler in StdioServerParameters from "strict" to "replace". Malformed UTF-8 bytes from a child server stdout previously crashed the client transport with UnicodeDecodeError. With "replace", invalid bytes become U+FFFD and the line fails JSON-RPC validation, which is surfaced as an in-stream Exception that the session can handle. This mirrors the server-side stdio hardening from PR #2302. Test Plan Reproduced the crash with a child process emitting \xff\xfe\n followed by valid JSON-RPC. Verified the fix: first item is a ValidationError, second item is the valid SessionMessage. Added regression test test_invalid_utf8_from_the_server_surfaces_as_an_in_stream_exception. Full tests/client/test_stdio.py suite passes (34 passed, 1 skipped). Notes Fixes #2454 Scope intentionally small.
Open Graph Description: Summary Changes the default encoding_error_handler in StdioServerParameters from "strict" to "replace". Malformed UTF-8 bytes from a child server stdout previously crashed the ...
X Description: Summary Changes the default encoding_error_handler in StdioServerParameters from "strict" to "replace". Malformed UTF-8 bytes from a child server stdout previou...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2907
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c70633c4-9b0c-7d81-fdc4-a3039348840e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CA52:22F8BE:A58C0:D29A1:6A5B5CE5 |
| html-safe-nonce | 05daa1f5e219c7f2bdeee65c2ec2c3eec1980c4526f358200ceb4f18671aec6b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTUyOjIyRjhCRTpBNThDMDpEMjlBMTo2QTVCNUNFNSIsInZpc2l0b3JfaWQiOiIxMzkzMTk4MDY1ODc2OTUwMjQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 14b4d1c98df0844b15a526ac0330a71d8fd1cdf8180c70ce1f4d1297f76ef580 |
| hovercard-subject-tag | pull_request:3889543211 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2907/files |
| twitter:image | https://avatars.githubusercontent.com/u/32209706?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/32209706?s=400&v=4 |
| og:image:alt | Summary Changes the default encoding_error_handler in StdioServerParameters from "strict" to "replace". Malformed UTF-8 bytes from a child server stdout previously crashed the ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width