-
Notifications
You must be signed in to change notification settings - Fork 815
After upgrading Kimi CLI to version 1.17.0 on Ubuntu 22.04, I get the following error when trying to run the program: #1332
Description
What version of Kimi Code CLI is running?
1.17.0
Which open platform/subscription were you using?
/login
Which model were you using?
kimi-for-coding
What platform is your computer?
Linux 6.8.0-101-generic x86_64 x86_64
What issue are you seeing?
markdown
Description
After upgrading Kimi CLI to version 1.17.0 on Ubuntu 22.04, I get the following error when trying to run the program:
httpx.LocalProtocolError: Illegal header value b'#101~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 11 13:19:54 UTC '
text
The program crashes immediately after startup and cannot be used.
Root Cause
The error occurs because Kimi CLI uses the content of /proc/version (via platform.version()) to construct the X-Msh-Os-Version HTTP header. On Ubuntu systems, this string starts with the # character, which is forbidden by HTTP specification for header values.
Specifically:
platform.version()returns:#101~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 11 13:19:54 UTC- The
#at the beginning makes the entire header invalid, causinghttpxto reject it withLocalProtocolError.
Steps to Reproduce
- Install Kimi CLI 1.17.0 on Ubuntu 22.04 (or any system where
/proc/versionstarts with#) - Run
kimi - Observe the error
Expected Behavior
The program should start normally without crashing.
Actual Behavior
The program crashes with the httpx.LocalProtocolError shown above.
Environment
- OS: Ubuntu 22.04.5 LTS
- Kernel: 6.8.0-101-generic
- Kimi CLI version: 1.17.0
- Python version: 3.10.12
- Installation method:
uv tool install kimi-cli
Proposed Fix
Replace platform.version() with a safe combination of platform.system() and platform.release().
File 1: kimi_cli/auth/oauth.py (line 212)
Current code:
"X-Msh-Os-Version": platform.version(),
Suggested fix:
python
"X-Msh-Os-Version": f"{platform.system()} {platform.release()}",
### What steps can reproduce the bug?
File 2: kimi_cli/utils/environment.py (line 31)
Current code:
python
os_version = platform.version()
Suggested fix:
python
os_version = f"{platform.system()} {platform.release()}"
Result before fix:
text
#101~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 11 13:19:54 UTC
Result after fix:
text
Linux 6.8.0-101-generic
### What is the expected behavior?
dditional Context
This issue does not occur on systems where platform.version() returns a string without the leading #. The problem is specific to Ubuntu and possibly other distributions that include the build number prefix in /proc/version.
I have manually patched my local installation and confirmed that the fix works.
Possible Related Issues
The same problem might occur anywhere else in the codebase where platform.version() is used to construct HTTP headers.
Consider reviewing all uses of platform.version() for header construction.
### Additional information
_No response_