fix(auth): strip whitespace from HTTP header values to prevent h11 rejection#1229
Open
privatejava wants to merge 2 commits intoMoonshotAI:mainfrom
Open
fix(auth): strip whitespace from HTTP header values to prevent h11 rejection#1229privatejava wants to merge 2 commits intoMoonshotAI:mainfrom
privatejava wants to merge 2 commits intoMoonshotAI:mainfrom
Conversation
…jection On some Linux systems, `platform.version()` returns a kernel version string with a trailing space (e.g. "MoonshotAI#100~22.04.1-Ubuntu SMP ... UTC "). This trailing whitespace violates RFC 7230 field-value grammar, causing h11 to raise `LocalProtocolError: Illegal header value` and making the CLI unable to connect to the API. The existing `_ascii_header_value()` only stripped whitespace in the UnicodeEncodeError fallback path. This change ensures `.strip()` is always applied, matching the behavior that was already intended for the non-ASCII path.
|
You can manually patch the OAuth module in your installation. edit this file: Edit the oauth.py file in your uv tools installationnano /home/USERFOLDER/.local/share/uv/tools/kimi-cli/lib/python3.13/site-packages/kimi_cli/auth/oauth.py Before (broken):"X-Msh-Os-Version": platform.version(), After (fixed):"X-Msh-Os-Version": platform.version().replace("#", "").strip(), |
|
这个预计在哪个版本发布解决,试了1.14还有这个问题 In which version is this expected to be released? I tried 1.14 and still have this problem |
This was referenced Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Resolve #1226 #1227, #1220
Description
Kimi throws an error
LLM Provider errorwhen trying from Ubuntu 22.04.5 LTS .On some Linux systems,
platform.version()returns a kernel version string with a trailing space (e.g. "#100~22.04.1-Ubuntu SMP ... UTC "). This trailing whitespace violates RFC 7230 field-value grammar, causing h11 to raiseLocalProtocolError: Illegal header valueand making the CLI unable to connect to the API.The existing
_ascii_header_value()only stripped whitespace in the UnicodeEncodeError fallback path. This change ensures.strip()is always applied, matching the behavior that was already intended for the non-ASCII path.Here is the detailed logs from
~/.kimi/logs/kimi.logChecklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.