Connection error on Linux: illegal '#' character in X-Msh-Os-Version HTTP header #1192
Replies: 3 comments
-
Update: VS Code Extension also affectedThe same bug breaks the official Kimi Code VS Code extension on Linux. Error in VS Code: |
Beta Was this translation helpful? Give feedback.
-
Update: VS Code Extension also affected (cannot be patched manually)The official Kimi Code VS Code extension (v0.4.1) has the same bug on Linux. Error: Root cause: The VS Code extension ships its own bundled CLI binary at: This is a PyInstaller-compiled binary — the Python source is baked in and cannot be patched manually like the Workaround: Point the extension to the manually patched CLI via {
"kimi.executablePath": "/home/vladimir/.local/bin/kimi"
}This means the fix must be applied in two places:
Please rebuild and republish the VS Code extension with the same fix applied. |
Beta Was this translation helpful? Give feedback.
-
|
太棒了,我按照你的方式成功修复了! Awesome, I successfully fixed it your way! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of Kimi Code CLI is running?
version 1.12.0
Which open platform/subscription were you using?
/login
Which model were you using?
kimi-for-coding
What platform is your computer?
Linux 5.15.0-100-generic x86_64
What issue are you seeing?
Every message returns "LLM provider error: Connection error".
The CLI is completely non-functional.
Full error from logs (~/.kimi/logs/):
httpcore.LocalProtocolError: Illegal header value b'#100~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 19 17:10:19 UTC '
Root cause: _common_headers() in auth/oauth.py passes platform.version() directly
as the X-Msh-Os-Version HTTP header value. On Linux, platform.version() starts with
'#' which h11 rejects as an illegal HTTP header character.
What steps can reproduce the bug?
kimi login, select Kimi CodeVerify the issue:
python3 -c "import platform; print(repr(platform.version()))"
Output: '#100~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 19 17:10:19 UTC '
Note the '#' at the start — this is what breaks h11
What is the expected behavior?
The CLI should sanitize platform.version() before using it as an HTTP header value.
Fix in kimi_cli/auth/oauth.py, function _common_headers():
Before
"X-Msh-Os-Version": platform.version(),
After
"X-Msh-Os-Version": platform.version().replace("#", "").strip(),
Additional information
No response
Beta Was this translation helpful? Give feedback.
All reactions